Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp540103imm; Wed, 18 Jul 2018 06:39:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf9TGT7AGEQM+SF/LIa6teTLKpanQP2yg2TmoFXOSheUItX2NH2j1VWp2tJDDSu+Gv0eAYC X-Received: by 2002:a17:902:5a83:: with SMTP id r3-v6mr5898069pli.78.1531921156700; Wed, 18 Jul 2018 06:39:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531921156; cv=none; d=google.com; s=arc-20160816; b=m88n1xEIkU47Vt2OrCXfY+lGkXPlGmDAwAbaThviq1w41olv04IC+35Jqek40+m29F SOQf7W+I3XyiXv+qTNApgMkAEN5drudesw2NEA1AihY8ZTxXNU4gnwKG67YEfYbwS4hK riwRzLAPzAFyNQZ0ngzLv8ol/Dl5WXuYTcYrJuoUDNjXUCbY4DUZbaQ6bYSRUL1He7YF ky6GWqJUbTFuzNY1gDFFMX8kKFH0Wpv3YnMLP9Fqs4hP1GkEPUGXEo82ABWErumaaL00 N4timbjpRJwdqAqHe63nhJLPn8jNonu69WYqE+UUEHlfIGIFfKGg9liRNARuyAqwNz/0 9KWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=CnniiSWxY3paOgDOvI1YCAZukBWlLSLf+XLT17roP6I=; b=RAwMgdA2z4BgxrGQ+wlLtQ8egTO+W18tvCVEVq2X1F0PTVBnqLX072gUiNuHDYstLH 61wNK65DvgPQj4U8B8tG7QzOpQ8XPPa2JQueja3zYKTNKfcHYGF6fl+Cny6Lu4Dn+bU8 UrBQuZSidz1UWvLR8ifviN1+pVFZVdPMuKpzeAYHXYN7EZfwObfoSYbFNt5/6POlfexT HIGQa5QxOkZckpQFIvkIoI/lSd2Wnz6joCw5hlkw9Hky/sAXMx+CgO+31H0JGlPIqoHh onInEiOnLlqOQh99gQUcUela0FzEKX8zu0NBVEWNrDP+RB49DfMFpao1GXFpVpMmYIQ6 Oikg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26-v6si3385358pfj.188.2018.07.18.06.39.01; Wed, 18 Jul 2018 06:39:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731611AbeGROOb (ORCPT + 99 others); Wed, 18 Jul 2018 10:14:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:38084 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731248AbeGROO2 (ORCPT ); Wed, 18 Jul 2018 10:14:28 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id D25B8AD86; Wed, 18 Jul 2018 13:36:28 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Roman Gushchin , Michal Hocko , Johannes Weiner , Christoph Lameter , David Rientjes , Joonsoo Kim , Mel Gorman , Matthew Wilcox , Vlastimil Babka Subject: [PATCH v3 3/7] mm, slab: allocate off-slab freelists as reclaimable when appropriate Date: Wed, 18 Jul 2018 15:36:16 +0200 Message-Id: <20180718133620.6205-4-vbabka@suse.cz> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180718133620.6205-1-vbabka@suse.cz> References: <20180718133620.6205-1-vbabka@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In SLAB, OFF_SLAB caches allocate management structures (currently just the freelist) from kmalloc caches when placement in a slab page together with objects would lead to suboptimal memory usage. For SLAB_RECLAIM_ACCOUNT caches, we can allocate the freelists from the newly introduced reclaimable kmalloc caches, because shrinking the OFF_SLAB cache will in general result to freeing of the freelists as well. This should improve accounting and anti-fragmentation a bit. Signed-off-by: Vlastimil Babka --- mm/slab.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/slab.c b/mm/slab.c index 9515798f37b2..99d779ba2b92 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2140,8 +2140,13 @@ int __kmem_cache_create(struct kmem_cache *cachep, slab_flags_t flags) #endif if (OFF_SLAB(cachep)) { + /* + * If this cache is reclaimable, allocate also freelists from + * a reclaimable kmalloc cache. + */ cachep->freelist_cache = - kmalloc_slab(cachep->freelist_size, 0u); + kmalloc_slab(cachep->freelist_size, + cachep->allocflags & __GFP_RECLAIMABLE); } err = setup_cpu_cache(cachep, gfp); -- 2.18.0