From patchwork Thu May 24 11:00:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 10424139 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 295D96032C for ; Thu, 24 May 2018 11:00:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EB0D29381 for ; Thu, 24 May 2018 11:00:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2328E2939B; Thu, 24 May 2018 11:00:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95BCF293A0 for ; Thu, 24 May 2018 11:00:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 470EC6B000C; Thu, 24 May 2018 07:00:25 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3F5836B0010; Thu, 24 May 2018 07:00:25 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 295FA6B0266; Thu, 24 May 2018 07:00:25 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f72.google.com (mail-wm0-f72.google.com [74.125.82.72]) by kanga.kvack.org (Postfix) with ESMTP id D9D376B000E for ; Thu, 24 May 2018 07:00:24 -0400 (EDT) Received: by mail-wm0-f72.google.com with SMTP id e15-v6so920994wmh.6 for ; Thu, 24 May 2018 04:00:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=+r9D8Zz8H3z7LMLsHIQe5Aicp8AXsM72NVYUbcn9btc=; b=WKYR96ywKTHftNHrbiFBm8f7camOTCc1FQZzMFdn2cfqrVfDGeGzAx+rdAYRAZM1eE pEIYa22m/UruCJAUvF24C7U9TdbWUmRrKNv9cLLR7zreRWG3UOz4GuRjoshD4Ek6bFBJ sNP6OpuZWTsU2XDdSqPBVXcOzI1VaRKTVdO8wevKH7lX/Vm2ERv6aA2d9qQfVyqXVe8c O1UMu7romSwI86EOB4jTd6Zk+vZIM0365wtTjp4tDHyCYj69tmrJ8JhHWffirehPxyOa RhbWExZwO0K4a099HTHeUp3+ZAt/yvgicC4E4Rn+bdBp5Gik8ovzzr+RBLRWkpFF5cav lnFA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Gm-Message-State: ALKqPwcSbn/+IPywyjft5W+CZJIGdBaRPXYWd2+8QMFrt7gnT/A3RmEF 3D/GvlQvpR1ek1v/Y6l16zC4S/NNDrf1KSAHwOoJfjaWi+GTXGfWCyBXgFMSx6qX3n+f7ZCVwsG VNGJBdxzYf14JT9TeBfjvhvjIdqdhjNX95Fsq2YirM2kPctG8nSqzWtBnNgVvZCdmyg== X-Received: by 2002:a50:ee8c:: with SMTP id f12-v6mr11759850edr.10.1527159624447; Thu, 24 May 2018 04:00:24 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoyLUf/VIl59hF/wN20CtK6dHiD6iFxISZy78fLBIdDxI06+K6BkSgFhi+HPvFHF9yI5YPO X-Received: by 2002:a50:ee8c:: with SMTP id f12-v6mr11759802edr.10.1527159623799; Thu, 24 May 2018 04:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159623; cv=none; d=google.com; s=arc-20160816; b=r2GNPIZwCb2sdwsckPnpch/bvpwcTYgwjjsQ21bCh+2ilkAYvlvBxQemO0kyJFrB9f HIDHdu1kWsIEgJosM1CNYgNp5fr+IiguZEsX0Z96sVrRWwikHnjpb6XSdnKUbl2+KByp rNtwShHkQErm6v7Y3GqrbHl48UZiFO/9mg6BnTux+HE+cLZi3R1QJU1SY+IyBqrnqwfp 5d6PRtEKkzdYjgdI0mQ8BA6BoQU9+3dpWWlBUDX35y07oQcgJ3ma3OWC6quHofBvwLgu YTg4HekuOfzVEULtZ7GRNlTum0aZJDaolishI4w/BThJ3kTim+s5iSUTLRMMBYo2kHtG fCuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+r9D8Zz8H3z7LMLsHIQe5Aicp8AXsM72NVYUbcn9btc=; b=djsNp5vJTdNyotTHuAAfD1MVtWuDwB1XGqwzDJqVGe8MGo0AQkxrG/KxYtXc74gQKG ZSxXTm1l5v1vaMO9CX5cOH1M/GaYEp+rtshPn8YCs8l8Odc5wrpIYmLaMZy8L6UbVRfR Ny8/IiA7mt6yltOBNNkjK4zCCKY48to0/cR14PYEpn74VZ8SUO5giHvU0HW8e4qH3lHe yGIDW5FEh2GxDj9zBq5TBr2Z4jfq7lO7YnMhsHL+BHqJNFioynwf6dyTo9s9XOKSXucr HQ9jD/4Q5iLM65DBPUb8zsmMTXcu4g9cqlScIMGNhApphcL6bsYtMWWCdj2K5pgdEky3 Lx0w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz Received: from mx2.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id q27-v6si5453335edq.244.2018.05.24.04.00.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 24 May 2018 04:00:23 -0700 (PDT) Received-SPF: pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) client-ip=195.135.220.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of vbabka@suse.cz designates 195.135.220.15 as permitted sender) smtp.mailfrom=vbabka@suse.cz 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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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);