Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1983033imm; Thu, 24 May 2018 04:01:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZodAwKraCoJw3VykYfDiC8wf93TWLEGBs/i156y2MG+1/31kM6qBRWwzu0kz3YWRFhBh6hh X-Received: by 2002:a62:990f:: with SMTP id d15-v6mr6731665pfe.115.1527159703498; Thu, 24 May 2018 04:01:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159703; cv=none; d=google.com; s=arc-20160816; b=MIPB47x78ptw0wgjEI6oPAJUKdEhIZZ4guquYZKYnW58UCgeRQeLy5noPnY8fNFjHf kcnKKas9Sy66PxsulNtuts4zRdQabLWRBSYIV6dMIRoKlK3xLR3Q3TFn9BpT5eQ8Wi4y Il0rbp5vVpR/sLdPTdDpxzoU+1zilqRFFrWWVItEaL3XXUPbnR8WURLybXTt6hEJlQ9z SSNKLkEyvoxEi8mbQBcRQeqOS3N45ZwCKNey5wr2mFMJ9QWvzty7ydU5hqoFF8B2vi+r GPnVXlykZhvZoNE37hVbytK6rZ1/rY1iQs1fSzEl9aPzehxuUdJm6LpER2u4oWKKQWST +sgQ== 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=+r9D8Zz8H3z7LMLsHIQe5Aicp8AXsM72NVYUbcn9btc=; b=p0pcJxH4pp+30nie6mYCE/cf0zWwwixNewPSvgH7CcWWndP05JJC7uKBFw+saGMzLb LRe27wliM2TWUD0dPXODA52MaW34KRC28wztpHeQsFoqxORfGJHlppbUf5/CDhOM58z8 YL7zasdAr3zYEMtFtJ03KuG+sRnmNR9dsCiEj3S5xKLl6sqXUmEV7LedXN4uydaakje6 HCn6AYusoGjOr2ABNEFPAuJK+MXyg7qd+QVXmOaRX/cI85TRcFdzVKLU7lbNfk+ugKL/ EVUoQhlQ8phGsGP9WpORe77Br/0jjwdoSOS2pcfLHBgUt9M1uG7we+s88piD6OKwuelv YAzA== 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 v5-v6si19722184pfe.63.2018.05.24.04.01.23; Thu, 24 May 2018 04:01:43 -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 S1032784AbeEXLA3 (ORCPT + 99 others); Thu, 24 May 2018 07:00:29 -0400 Received: from mx2.suse.de ([195.135.220.15]:36143 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030243AbeEXLAY (ORCPT ); Thu, 24 May 2018 07:00:24 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id CF91FAF38; Thu, 24 May 2018 11:00:22 +0000 (UTC) From: Vlastimil Babka To: linux-mm@kvack.org Cc: Roman Gushchin , Michal Hocko , Johannes Weiner , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Mel Gorman , Vijayanand Jitta , Vlastimil Babka Subject: [RFC PATCH 2/5] mm, slab: allocate off-slab freelists as reclaimable when appropriate Date: Thu, 24 May 2018 13:00:08 +0200 Message-Id: <20180524110011.1940-3-vbabka@suse.cz> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524110011.1940-1-vbabka@suse.cz> References: <20180524110011.1940-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 8d7e1f06127b..4dd7d73a1972 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -2142,8 +2142,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.0