From patchwork Tue May 22 10:09:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10417877 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 66BF06053B for ; Tue, 22 May 2018 10:09:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5486D27F90 for ; Tue, 22 May 2018 10:09:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4548B28BAB; Tue, 22 May 2018 10:09:57 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 5C2D628BAB for ; Tue, 22 May 2018 10:09:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2A5996B000A; Tue, 22 May 2018 06:09:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 27D6D6B0276; Tue, 22 May 2018 06:09:55 -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 145896B0278; Tue, 22 May 2018 06:09:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id D54C46B000A for ; Tue, 22 May 2018 06:09:54 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id m20-v6so17498891qtm.6 for ; Tue, 22 May 2018 03:09:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding:spamdiagnosticoutput :spamdiagnosticmetadata; bh=4oijJ5d9KyctgdtEicyqtPoO/AzCJ55A543+tvd07/M=; b=EHv1k3L5m/PKjfBweCalbrTKQnHj6qqH3g2jyTltImjO9dSTT/7MhK7c7NBU0r+XNP ak4z3NTfCBKguTEde2b3mR9dmDIFIzA3DE6HD3W8mrCJEqz0t4fsUykMqm9N4OetxMbv M2843KexVmynSWLGvlQbq45cs9BIAWKGa8TbUp4EjqOEC3EpHKsaqhJ7kdCxz7YAjGoO Dxn/OXNuejZ+hG4mmRhDD4WX74wEacDSET13p91utI/A9I/Rkh3+BmkZSLkECnwsZYtl fFVR9j8ayEj2q/B8y+NgMVSjELtX89ayr3RAQdkPbISh9XnNsgiF9VQcGMdZadkVawfm /WfA== X-Gm-Message-State: ALKqPwea5tAPMtlhNDHY+s7b4p7wJrJ2dvqHN3HQp4UXky4Uhst34Zjf uYznWNhEfhGaOfxKiANBRIDQCeAJc74bqDA/xoqoZ7aNKRCJpySUuVmFEYW9/iq4vfxGZWA8O+G WD2SjPzJeusBJduGHHnCMccNjAo7z+MnOBnVvTcxT7i8Hhq/OmX3mjcEKrm2MY3z3MQ== X-Received: by 2002:a37:ba42:: with SMTP id k63-v6mr20488002qkf.436.1526983794642; Tue, 22 May 2018 03:09:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoqjNhAmYjVbGA07OCQeFXLv18leVqL02zgxtNqBll6k7J7UwRTgn19YjELYrui2fs6RRax X-Received: by 2002:a37:ba42:: with SMTP id k63-v6mr20487957qkf.436.1526983793622; Tue, 22 May 2018 03:09:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526983793; cv=none; d=google.com; s=arc-20160816; b=BQO2uVccuL2qu2MqenL6WW6R0mVJLAZ4z7xWSh3i1CQHjNqmk9onp2b2cImuc9BK45 lpcPlNIONxYyXQ6KUDyItTg9b9JtlXdg03pf9pwYpdfSLu0v2MgRc/qb66KiZwmLHn85 97K+I6zOykDLkW26z48toe9bza3GMrwDyIDLpXYcXFVv6S8/tb4PfkHFCSHhJ2pcS+/r hb90yPop6l68gY2eF7kwRF1ofeNLY6FOuM+Zzi+Tr7mkk+zr4Z6zVUV4PUHxz6klvS1r +rzf9hlCMr+8DYn8YWXqsWpawfMLnbmuf3Hs/euT3BVroFtC2vfUBr+GaNdKh6GZZS0z NgTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=spamdiagnosticmetadata:spamdiagnosticoutput :content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:to:from:subject:dkim-signature :arc-authentication-results; bh=4oijJ5d9KyctgdtEicyqtPoO/AzCJ55A543+tvd07/M=; b=D+uE3Wk1FYwTXLyEZrogHyxOVD0+SRJW7rRwV0w3LKetgFxR0wrNpXhT5KgW0mRTh/ sbuFMetQ5dj5Xrc+/abAibOlHPsxCMHQj431NPfOpG5FdMYgayiEyhHrmKAuOEB6SAvP ZHE2tBF8b9/CrUl5i3AxxysqV4wZBq7g+VgLf7jOUe3zLAs8WH3Zmls1a8JAKoekJ9G6 wM5ff4rcIUCdTmIIJkQzB1/ze3wwDS9xqCm7L37va7tsAZMiRt/TIFImgHNGX/l3JSfq rAM/pdIm7oQgWWQLUsTkqNJuAsS2oNWkAzyH1rGKmvWHNGFLp8ealZYGMuW+kqs6hK8/ W30g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=ZwuR4Tz0; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.93 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0093.outbound.protection.outlook.com. [104.47.0.93]) by mx.google.com with ESMTPS id p21-v6si4056612qta.22.2018.05.22.03.09.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 May 2018 03:09:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.93 as permitted sender) client-ip=104.47.0.93; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=ZwuR4Tz0; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.93 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4oijJ5d9KyctgdtEicyqtPoO/AzCJ55A543+tvd07/M=; b=ZwuR4Tz0mELyJLbXTpzPYvnnNfFMHiX+ubdLXeHSXknUTLZ4BKT//M91kqLoYjcMGXAJj9W0AIUM/HdZXgNBQFvQnC4A6JIM/PZUB2BixXZMcjvRy5lRrFeWIvy4ilGCj0Vw5UW5XPzuSXy9AlXfRwTe4WAUxlMfxaULTHpfkD8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by VI1PR0801MB1342.eurprd08.prod.outlook.com (2603:10a6:800:3a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 10:09:45 +0000 Subject: [PATCH v7 14/17] mm: Iterate only over charged shrinkers during memcg shrink_slab() From: Kirill Tkhai To: akpm@linux-foundation.org, vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, ktkhai@virtuozzo.com, tglx@linutronix.de, pombredanne@nexb.com, stummala@codeaurora.org, gregkh@linuxfoundation.org, sfr@canb.auug.org.au, guro@fb.com, mka@chromium.org, penguin-kernel@I-love.SAKURA.ne.jp, chris@chris-wilson.co.uk, longman@redhat.com, minchan@kernel.org, ying.huang@intel.com, mgorman@techsingularity.net, jbacik@fb.com, linux@roeck-us.net, linux-kernel@vger.kernel.org, linux-mm@kvack.org, willy@infradead.org, lirongqing@baidu.com, aryabinin@virtuozzo.com Date: Tue, 22 May 2018 13:09:43 +0300 Message-ID: <152698378300.3393.14754283083814172297.stgit@localhost.localdomain> In-Reply-To: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> References: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM6P193CA0013.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:3e::26) To VI1PR0801MB1342.eurprd08.prod.outlook.com (2603:10a6:800:3a::28) X-MS-PublicTrafficType: Email X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1342; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1342; 3:FIao7FOzdzGiKAoF+arv6ubYmD3i0UtpLQg0D/O/+dpcxLuQzwgFhGVh+rPhMAre5IY6pLYT6LJlLXpnZcEPtu3X9Z0TF4bHbNWYoC8BLvClH5PrRYO0UK7/rAdI8qLjRdSqFGzcYHI59JD1DI67Em/AibVFaovQl0HRJyDG/crVpuGa0zpG7l3PDVaB//PQL3AVZrwd3jtfXqxdfo2E0J42xlxtyTjbWixDJfPEc1s5o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qvTxTJEvFuQ810fuO96WpqbNGKad2kjAHSVJZiF8P2Fw7dhjOAk5oHDDPHhRVmtfzSrMuqNKpxkgSYi3lYE6LC9CDK8oz0/RD1AmSj8Ws7BbeH; 4:01P3fehXqvm0pXWVOiP24v7VnMnz74Ewsk5zFB2nQA73soghFEH5Mbq6hRU3sIrtghPzbpusiiZRvVkwtwmons9/gUHNOYIQgSRSASvSY8sFMUMvF3SGpfr+WoxgiYfaGVDqhKWC6hHHHLOLBhgvhqf6eljoVm4jXgxnyONE2R9LaffwvhoaIepnpLO9JWbDEK2bnnSHU2L8pLfyQnYhT7zfTlhIabRDT6bGVzni7r6DCx6jPenin6K/wAOJt/7ulvY4m3yLvN3xtMhvn6SOlg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR0801MB1342; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1342; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(39850400004)(396003)(366004)(39380400002)(376002)(189003)(199004)(39060400002)(50466002)(81166006)(61506002)(55016002)(53936002)(103116003)(478600001)(6636002)(7736002)(316002)(305945005)(8676002)(81156014)(66066001)(47776003)(8936002)(105586002)(58126008)(106356001)(230700001)(476003)(97736004)(11346002)(956004)(68736007)(446003)(486006)(25786009)(7416002)(26005)(52116002)(23676004)(386003)(6506007)(9686003)(59450400001)(33896004)(55236004)(86362001)(2486003)(76176011)(6116002)(7696005)(5660300001)(186003)(16526019)(2906002)(3846002)(921003)(1121003)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1342; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtWSTFQUjA4MDFNQjEzNDI7MjM6WlFmYmpsbWowellDK2ozWmFIbnlLaTFY?= =?utf-8?B?WDRTZFlUOGRZSndGK1Mxd0thTmNpbW9reVcwcXhGM2JRVlVkY2k4ZndHVEdE?= =?utf-8?B?MllzbmlzK2VWOWVaa1hvNkRLR2JTaGdsOGFwbFBsRzZYZVZYN2hFb2RyTjJX?= =?utf-8?B?ZnlabFM3SVpHN3Y2bFZ6VXBLMnl3eThjVFFXTGhnQk84UjlsR1lRNExSc1Er?= =?utf-8?B?U0x5T0VCRk5wYXVHaGJQSFZmS1lZSVViUjNhU3FVL2N6bzJtUjVIc2huWk1M?= =?utf-8?B?cFpYQTVsRC9kam8yVExrbDJSYWdXU05WS3lQN29XYmgxaTJlbStaeC82dDZ5?= =?utf-8?B?M0VvbElBalhvUmR0VXlkZzM3RlZHMC9lWFJOQjlMdVNuRWV3WTRjc2Zna21z?= =?utf-8?B?Nkx4djZ0WWdtKzA1Wmh2ek5hbXRYSi9VeGNHZ1UxNHpyaEE5dGRaR2swdU41?= =?utf-8?B?dys0TWpwS2psWHNSZWxEbSt4N0NMSmN6Z3A1VGdUdVVyQjZFdkxvb005WE1C?= =?utf-8?B?ZkxoK0dzRzBiVzlrMVM1YlA2eEU5RnhERmo5WnJUQi9CODlHbGhWSkwzZ0ZL?= =?utf-8?B?MDJBY25LZGpCUy9xQndldTV4R0c2N2ZTVnJNZWJZcGZoT1pmYzRld0VPT0hQ?= =?utf-8?B?M1hKOVc5Q2hZdlIzYVRkaWZMQmZTV1NMNFg1MUJZUUFlTkdJMTV4UmFFbVlH?= =?utf-8?B?Nk13NW15a05xYklDNjVlby90TFcrNjJNc0J2TG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CtJAvcUDfEaJhNj8GkvZd2MQiCc1PjTVZIclm5KwX826r6ayttB8YEuVLvSQrzfTyFPol3KmT28RgInHRWUrz4gI71pI+Xs=; 24:nHOvBjk20fguY97Nj8nV1k6TxW9gCn2P1VO+qReX4ytJ/6PBCprtWN3kdq+vwr9wbvVLQrzoDa3cxnP4m2IpfD2E564hSm27lmXyYKBB4gs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1342; 7:nw/XocK7Myc1nokt6bhYjmKA4Qleo95XuJNygSXX0qT9pWwuwLBnO+TJxUPkOMKNmqZbSgqWuTas6vhpjvY85ka3+GHmsm+/4Oxu7HXIaj0ncKA9iayKwIdMfuTYCHF0gp0mHmexprSGgGWE/6vQa8QHfw334CbBjgY+gdmsa0uSUF5MtJN9g24awpPf09sf6/GAPyJnkBJflkWlb0oSF+cA3OT8RZG8mUREje7SJftjs6Qbg29rpseKfUA5O/nx; 20:ebpZNr0QYg37E07oRWFwxlxTtXFnQajQeH2nWMd3YLWlPae5glqBdRbSn+DuJOW6XfvjN8Of/e8W6a6fLC4kdELFXbcDZdddOMp37fyW9V0dIkuiqXsUhVAvVL15IN08QEpKGjkCtvgB4GBZUS9DofmTFvPHCM9jX4c6yOnm0ZM= X-MS-Office365-Filtering-Correlation-Id: 8a5f9f1b-f042-47e4-b3f0-08d5bfcc25ff X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 10:09:45.5476 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8a5f9f1b-f042-47e4-b3f0-08d5bfcc25ff X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1342 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 Using the preparations made in previous patches, in case of memcg shrink, we may avoid shrinkers, which are not set in memcg's shrinkers bitmap. To do that, we separate iterations over memcg-aware and !memcg-aware shrinkers, and memcg-aware shrinkers are chosen via for_each_set_bit() from the bitmap. In case of big nodes, having many isolated environments, this gives significant performance growth. See next patches for the details. Note, that the patch does not respect to empty memcg shrinkers, since we never clear the bitmap bits after we set it once. Their shrinkers will be called again, with no shrinked objects as result. This functionality is provided by next patches. Signed-off-by: Kirill Tkhai --- mm/vmscan.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index d8a1ca350a58..f26ca1e00efb 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -367,6 +367,20 @@ int prealloc_shrinker(struct shrinker *shrinker) goto free_deferred; } + /* + * There is a window between prealloc_shrinker() + * and register_shrinker_prepared(). We don't want + * to clear bit of a shrinker in such the state + * in shrink_slab_memcg(), since this will impose + * restrictions on a code registering a shrinker + * (they would have to guarantee, their LRU lists + * are empty till shrinker is completely registered). + * So, we differ the situation, when 1)a shrinker + * is semi-registered (id is assigned, but it has + * not yet linked to shrinker_list) and 2)shrinker + * is not registered (id is not assigned). + */ + INIT_LIST_HEAD(&shrinker->list); return 0; free_deferred: @@ -541,6 +555,67 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, return freed; } +#ifdef CONFIG_MEMCG_KMEM +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, + struct mem_cgroup *memcg, int priority) +{ + struct memcg_shrinker_map *map; + unsigned long freed = 0; + int ret, i; + + if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg)) + return 0; + + if (!down_read_trylock(&shrinker_rwsem)) + return 0; + + /* + * 1) Caller passes only alive memcg, so map can't be NULL. + * 2) shrinker_rwsem protects from maps expanding. + */ + map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, + true); + BUG_ON(!map); + + for_each_set_bit(i, map->map, shrinker_nr_max) { + struct shrink_control sc = { + .gfp_mask = gfp_mask, + .nid = nid, + .memcg = memcg, + }; + struct shrinker *shrinker; + + shrinker = idr_find(&shrinker_idr, i); + if (unlikely(!shrinker)) { + clear_bit(i, map->map); + continue; + } + BUG_ON(!(shrinker->flags & SHRINKER_MEMCG_AWARE)); + + /* See comment in prealloc_shrinker() */ + if (unlikely(list_empty(&shrinker->list))) + continue; + + ret = do_shrink_slab(&sc, shrinker, priority); + freed += ret; + + if (rwsem_is_contended(&shrinker_rwsem)) { + freed = freed ? : 1; + break; + } + } + + up_read(&shrinker_rwsem); + return freed; +} +#else /* CONFIG_MEMCG_KMEM */ +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, + struct mem_cgroup *memcg, int priority) +{ + return 0; +} +#endif /* CONFIG_MEMCG_KMEM */ + /** * shrink_slab - shrink slab caches * @gfp_mask: allocation context @@ -570,8 +645,8 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct shrinker *shrinker; unsigned long freed = 0; - if (memcg && (!memcg_kmem_enabled() || !mem_cgroup_online(memcg))) - return 0; + if (memcg && !mem_cgroup_is_root(memcg)) + return shrink_slab_memcg(gfp_mask, nid, memcg, priority); if (!down_read_trylock(&shrinker_rwsem)) goto out; @@ -583,13 +658,7 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, .memcg = memcg, }; - /* - * If kernel memory accounting is disabled, we ignore - * SHRINKER_MEMCG_AWARE flag and call all shrinkers - * passing NULL for memcg. - */ - if (memcg_kmem_enabled() && - !!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE)) + if (!!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE)) continue; if (!(shrinker->flags & SHRINKER_NUMA_AWARE))