Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3689865imm; Mon, 18 Jun 2018 02:21:08 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJgDKosof09sPmDFD9nptp5njOHqngDJ8FPXRIZ9j4PnhPQiuZoknlDr5rMYDX561PSgv7C X-Received: by 2002:a17:902:7c8b:: with SMTP id y11-v6mr12816957pll.222.1529313668801; Mon, 18 Jun 2018 02:21:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529313668; cv=none; d=google.com; s=arc-20160816; b=oRtNH1D2qwu+tBDvqSyfm1wZGxc1sUiabVdPzGUgeIk96T8oYwWDNRPqLbYVpYycd5 fPbPD1MH+aZRu8jDKdISEB5rvfZY87PRsDBUWCHc3g15lpYwaWlKJzdpgdu9RwhCLern p0UmJQgWOdXOjmEyanqRRgyc3pyO+IDh9eAwiVYA4kY8gtfSO1BIcfp+//GyyR1nY4X1 UR5y1zRyGG7XnwvBxC3s0N39Owcam/CjjXIbJZMwhjbePY7nrKgPtFUzL64XIjAltTvi TL7bJwlh4yo1HZ5QxeJfJ5YRez8tvJSpZDeX2Fe/79kgsk3bLhQ9eAn4w8eKz/ufa4tV yvJg== 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=LvBCOHeMqCSjLxyuW9gDuTN5997x6sCLp75nTKAFAXI=; b=nvl44ZFywicjXtH1pCj3KLF4RSr5tS+ugzy/bGAVodOgW5MKzzIwJX9aRBfM+72UQ+ LfU1fvVo69ojCzsiyhXq2DfzZaR2t1MT7BdnabIf9SUJlWF/6xUNLduRh3nr1en4ohP3 0DbiCM8MAwx38d+2Vbs6eeQqUwY73tGe3N8ZiYszZZxY1gqp3QBtYoE4rczZVutv9XTu Vz8xaH4UQzKwzxogsNVFOy/PtKnfulKawf0kfQms7Jbuj4nqLM6fQoPNozDcmXBlt0e7 J4lcrlMPFjnZPm2cs1tECoq7DqKUBB+MxxFBipie42Bj+ajU8Mvnz1co1GgkxfClrSnJ SLtQ== 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 c7-v6si14320403pfg.77.2018.06.18.02.20.47; Mon, 18 Jun 2018 02:21:08 -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 S966851AbeFRJS7 (ORCPT + 99 others); Mon, 18 Jun 2018 05:18:59 -0400 Received: from mx2.suse.de ([195.135.220.15]:38573 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936755AbeFRJSb (ORCPT ); Mon, 18 Jun 2018 05:18:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CE44AACC0; Mon, 18 Jun 2018 09:18:27 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Roman Gushchin , Michal Hocko , Johannes Weiner , linux-api@vger.kernel.org, Christoph Lameter , David Rientjes , Mel Gorman , Matthew Wilcox , Vlastimil Babka Subject: [PATCH v2 3/7] mm, slab: allocate off-slab freelists as reclaimable when appropriate Date: Mon, 18 Jun 2018 11:18:04 +0200 Message-Id: <20180618091808.4419-4-vbabka@suse.cz> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618091808.4419-1-vbabka@suse.cz> References: <20180618091808.4419-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.17.1