From patchwork Mon Jun 18 09:18:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 10470367 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 5F0AB6020C for ; Mon, 18 Jun 2018 09:18:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48060287A6 for ; Mon, 18 Jun 2018 09:18:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B9042883A; Mon, 18 Jun 2018 09:18:35 +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 C62E128768 for ; Mon, 18 Jun 2018 09:18:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 098986B000C; Mon, 18 Jun 2018 05:18:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id F12B16B026D; Mon, 18 Jun 2018 05:18:30 -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 C281C6B000E; Mon, 18 Jun 2018 05:18:30 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wm0-f70.google.com (mail-wm0-f70.google.com [74.125.82.70]) by kanga.kvack.org (Postfix) with ESMTP id 72D9E6B000A for ; Mon, 18 Jun 2018 05:18:30 -0400 (EDT) Received: by mail-wm0-f70.google.com with SMTP id v13-v6so4793468wmc.1 for ; Mon, 18 Jun 2018 02:18:30 -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=LvBCOHeMqCSjLxyuW9gDuTN5997x6sCLp75nTKAFAXI=; b=oj+VgwZLsak0oj9rm8lbBpObH9NwTbPMwbAvB7aQneTHGJ6TufazBP6Uuc2aRNMeC+ 5EWe6ImZRF46/atoxRNcGOjgHRhXBRJWUjDIVmrWxE6heRBGaK0YOqXojQ8W/rRSzu/q AvmE+VpU8K4aWowWEGWn0T2v0hUOGK+v8NbbR/l0kPVUHk88UK8kpt0yjb08YKhOUcU/ EAyIP2fL65SXekcKZE8amTfYedWnGrfcNQ5oYEOYZ+2ChDIEeSG1bd6u1AIiLr0Cfdep /+W+w6qFVI7AsactjLNCvWxZ0rEQ4YZ5Ysaedo14JwnliNW82Yhb5uSeEjka2gmXK2Vy kZNA== 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: APt69E1/F/CtdBPpSNsyWuDReW2aaDJ45msJdgq112gZmYkmr+ryHluq +ntUJFBy95cw+ZKG8YShrvAfpW3Pb4b6BGK2SnZhNsiw4mQm009bIX5ilwrucC/nVCd4RWJsVZK 6knE5vaPpv4/byz06gR7nAiOxuumiC1KVId1n5Es5ywZ4ggYcKV9ydVZmcPfTMasoYQ== X-Received: by 2002:a50:ac84:: with SMTP id x4-v6mr10431081edc.152.1529313509994; Mon, 18 Jun 2018 02:18:29 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLGYm2smq7uzMThUh2RY3HiSCpb9+pLsdq84ZNpo43KWl1ChoWS4H3C0r5sjloVtpC11i49 X-Received: by 2002:a50:ac84:: with SMTP id x4-v6mr10431031edc.152.1529313508891; Mon, 18 Jun 2018 02:18:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529313508; cv=none; d=google.com; s=arc-20160816; b=WdYuD5uxJ2ooEQo9Lbsg0Oq4o/LubhI7RiC4mCkrsg3RQwka4QUDQTBCAkJRJQVIvl XtIPLwIDzwYF8dY1TH74PkrKbXc7anGwZxckYxpkwB7pX+zutYZCRuqdMn0soed01p/X GIGXXCHHrRfPw2iAkg4RKt1vxDwC/Qpczad0a5Q18PMFZ2Z6ZeqtAB8DiIlmxb1VsXbY eeKzfkdxr9H02Geu7Ii88dfNv/G3llJYP2nTSm0jL0u9kiLfi6s+qdFn6LC0zBK3UG3W /UKfuPfjEW+IBG99Hk7CFU1Id83jZO16cD19qiZXmiS3rEOoqw4FM2pQwAtV9uPvJxNr 9JXw== 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=LvBCOHeMqCSjLxyuW9gDuTN5997x6sCLp75nTKAFAXI=; b=zl9SMXx1XDmKlVlHUf+fXU0rwrzyFiN4ug6JAiftb9O2+s3aMhvLA4p4K7dMijaAZS eClBd+MvsOVPR+JVEDEGT5ek3qCk+7MWT2+5Sh6QtXXOO/w23JVgoUCGjY+0Ch/AhLuH hFrvvCLKM2P2OaXd8JO2dzoC0LbsX+3xrhluLg9NzBSDd1fCwqMGGL0FGERpl5lHcdDO C8fP5G5pIWYOapDW3K07BZPcK77yuemZzuiZ2YwCqQL23nRgO5BTzBiLyUMc+g4ivJw4 7B2HJ5ud9ealaBXeqYNZ5PIRorP86wHf8tQP8EQ8LATfmAiLY6F6c5JsGgSsEceZVxB4 4dTg== 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 a55-v6si7911947edd.50.2018.06.18.02.18.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 18 Jun 2018 02:18:28 -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 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> 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 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);