From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B6E9ECDFB8 for ; Wed, 18 Jul 2018 13:36:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2C7B62075A for ; Wed, 18 Jul 2018 13:36:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C7B62075A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731614AbeGROOb (ORCPT ); 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