From patchwork Fri May 18 08:44:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10408797 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 97EEB60230 for ; Fri, 18 May 2018 08:44:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8572428462 for ; Fri, 18 May 2018 08:44:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78EE72888D; Fri, 18 May 2018 08:44:14 +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 C3C6128707 for ; Fri, 18 May 2018 08:44:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4E796B05BA; Fri, 18 May 2018 04:44:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9FC286B05BB; Fri, 18 May 2018 04:44:12 -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 8C58F6B05BC; Fri, 18 May 2018 04:44:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk0-f198.google.com (mail-qk0-f198.google.com [209.85.220.198]) by kanga.kvack.org (Postfix) with ESMTP id 624456B05BA for ; Fri, 18 May 2018 04:44:12 -0400 (EDT) Received: by mail-qk0-f198.google.com with SMTP id y127-v6so6321823qka.5 for ; Fri, 18 May 2018 01:44:12 -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=VYI6dnUnudZTM+MI6064HmYDiGBuZPhais+O3U+Bv6M=; b=ZmVo/lGbvnujrtwj8Dxh8jxuBv3mdiPZOL0F7AUnicsWXFJpmMsRUXgX1E4mRb6zxg wmjbHqgvFktDtc/RpJ22KMU2bwva5TfImqOmCBTnB6bc1y6trfBgJEEWe/qeaIcR+x7Z d7Ru14DfVHfPPV/J/Q5YhPL26EYEfcYJSm9CqJ4V+Xgh13KkdBSnhWWSl9WQThca5hXq S83NxfzgTLOeAmRS3jvtVsWaQFWDss3pXnnejPxiXhkato95ztCDDILeGK9efp//kd2K UaOSlIDtksqBFEgLzc+sq23jmP7HB8UbmiuDW4STWYCB6jIMzoHGK5QKQi0t/eflp7VD fK1Q== X-Gm-Message-State: ALKqPwf7fQDRlFWVIYX+p1RF/AjQF5sbAqB0gClQUZOc5n//0Y70AE+I 8A81jNFlXp1rfmFDIJgVkG2MDwZcC6IleMFFpb8JehvUqy0ME7kaBubsxLVohd0MIgmXmq8+d0u f8p8/tZ8ImxnHNkL814Sz13ggyK9MSJJUPW4fLQ8m60TDfClcttectcgzdx3PH1YkOA== X-Received: by 2002:a0c:b128:: with SMTP id q37-v6mr8140072qvc.19.1526633052181; Fri, 18 May 2018 01:44:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquwL0STYL1dp7RVmLHG3IuFLNVQG1bQujcbSOaWkGdx4gSuzsB9pCCaI7ZYDzBAzeVuif2 X-Received: by 2002:a0c:b128:: with SMTP id q37-v6mr8140023qvc.19.1526633050082; Fri, 18 May 2018 01:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526633050; cv=none; d=google.com; s=arc-20160816; b=R2huHs0DlusciJZXCTdZYg3ZEDmbtBwVuhTTi5OMhecBtds+t8F3CF61aBOLhq/S3G kONj+bU74P0QXtxsvKb46MUL5Q9DRgROwKH1kGgTHzQRsLvt2P8xAhS54BOglP8mGXgp KopozU64+FwZCV4EKOSplaPbxrQlN9UMXmqK/tZCB3PCbX1g6E7vgkUBz+Eb37DxyO/y lZVtrlNbVUbj4U35tZalXav/lHAzL1CLr9rWFLJWYAGC0xafAGgj8cBJapfAhh/dL6pH uatcnTzfO4TAhBa3TP66cuwOpXwZ+Bpniyn2Z9tyHMpqXzhTVZIlNxhPtEyQq56MI4TZ qTqQ== 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=VYI6dnUnudZTM+MI6064HmYDiGBuZPhais+O3U+Bv6M=; b=BZsBYeZbz0eRG6sQtA84JP2hbiBlqOxnG1jBLLHZIN8BN5IzuCLWGyLtNASYH/TBek oIz+NP5lRgFgXY9porfnX/hWt8eK4sPI+vZLGv7CJJR8boIDnoydz0M1gCi3je6Bdkcd zPOXPpkJFWNtAPQ3GtmHLFsmButgBfeOHmbe+nEOyM9g7tS42oby563BliyMTZvBdCTk e8bThUqMJmofPWNF6eqVYvZD0uuxUp+p/C4mbsL7GQ3wL53j8lmnVDdIS+m8NiBqJ1a7 8KORN9epBWjIh48mRn5FSO/BplRIGVU+DxK77FGVE4ODRhfvr4sQzp3/kH1UO2N7/uh0 4RtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=MtWwsvx9; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.104 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on0104.outbound.protection.outlook.com. [104.47.1.104]) by mx.google.com with ESMTPS id 12-v6si6893948qtc.338.2018.05.18.01.44.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 May 2018 01:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.104 as permitted sender) client-ip=104.47.1.104; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=MtWwsvx9; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.104 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=VYI6dnUnudZTM+MI6064HmYDiGBuZPhais+O3U+Bv6M=; b=MtWwsvx9414ZqeZDiCZRuaQE8/NI0ls1CUz1cwg9Pk9/kpQxCl7WVeF4dS9jXy9oxqOI4xtYjdGQe3F9fRECfxRqZNR7EzFVVPxsGLy/ZfG0LEDb5Rw1qYUcA5M1Wp3WXeAshnShefiAo21YIqDr8db3fpsfYZwHl0MtBbuOFKg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by VI1PR0801MB1341.eurprd08.prod.outlook.com (2603:10a6:800:3a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Fri, 18 May 2018 08:44:04 +0000 Subject: [PATCH v6 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: Fri, 18 May 2018 11:44:01 +0300 Message-ID: <152663304128.5308.12840831728812876902.stgit@localhost.localdomain> In-Reply-To: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> References: <152663268383.5308.8660992135988724014.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0902CA0021.eurprd09.prod.outlook.com (2603:10a6:3:e5::31) To VI1PR0801MB1341.eurprd08.prod.outlook.com (2603:10a6:800:3a::27) 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:VI1PR0801MB1341; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1341; 3:Zts5mOiddJsRpbcmVr+O3k6QNsHEUuopn50x56HnkfCcdo7+urKKWpw/O/1YCabg1mQLOjtLIRIfU1OYIkb4Pe37aLGdfK7Kp9ZnGWxN160f1MyEQ+ym++xEvDA6kggbVbSKj9pkOgPRpcrBAu3cOaFU37QNkyIunsOfR06cEbX/yju0/D5pA5AV5GGElemVvogX2/fy+xUL0lER4IvmNHL5bJA0OIiCvG2DsinYn+fjmJjmFHxamGH4XG2KK1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qdu/sCbLNxRaNpNgH4s+V9AtORivIi8E4YADlcKfid2PNL4KvmIX5FUShWutmb6KE7cIbHkDDTXKPa94q4M7WM/WD; 4:OjrPl+fe4EuYI7r1+135ZnZpmejtFRF1Tx/MuJou69Y0bn1Yo65DsefTCKnLtltSyMYbZUN/7dfdYMLpeVfPsjGxNBc9590kmGraDJPDOXj3CacIJupbs2nuljO/mnvojeJW3+VPZ4tPKwv5pbj4Wa4cXeMTNDBAA28qhERYG7vtRHZljgeo3EDMXeZI0SbamgRTwNsUZiMrLLYE6RfLYjPk3DkDWgSp3lrXaxgn5xbWIIr5fptbXk2BONftszpF7EWmJmJh++3qE8FZ7mq0Vg== 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)(3002001)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0801MB1341; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1341; X-Forefront-PRVS: 0676F530A9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(979002)(6069001)(376002)(39850400004)(39380400002)(396003)(366004)(346002)(189003)(199004)(6116002)(25786009)(39060400002)(81166006)(81156014)(106356001)(8676002)(68736007)(486006)(55016002)(8936002)(66066001)(47776003)(11346002)(3846002)(446003)(476003)(478600001)(956004)(105586002)(16526019)(103116003)(186003)(59450400001)(58126008)(9686003)(26005)(50466002)(53936002)(2906002)(230700001)(7736002)(5660300001)(33896004)(316002)(7416002)(97736004)(55236004)(6666003)(6636002)(61506002)(86362001)(7696005)(386003)(6506007)(2486003)(23676004)(76176011)(52116002)(305945005)(921003)(1121003)(309714004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1341; 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?MTtWSTFQUjA4MDFNQjEzNDE7MjM6eE1STDI0SGxEdVVNK3d0T2s5U1FFV2dT?= =?utf-8?B?ekFyMFMvUE1XeEp5MDhxMjdwWmROc3VPTTh0SWJSV1ZvaVo2WlVNa3hFU00r?= =?utf-8?B?V09XSEF2UVZ2aGx6SFdWeE5PYlQ3WnRlSEN2N2VQQkw4dFZSYXoyZHBCeGd1?= =?utf-8?B?NUI4RlhzK2h5WXVLTVZsSXNSbC92TFNoYkFQNWozMEdGYkd6Vnd0MzVhUUdJ?= =?utf-8?B?MUR3aHhKOXNPQmpYUlJ0Mk56cnZvU3RSeGt5TXI1MFhtSHVJb1JSbFFSVDJz?= =?utf-8?B?dXUxdDdpWFJieHYrUFJ3U1NLVmU0SGp6S0V5YytXY21TMEpxQXAxODBrRGtD?= =?utf-8?B?VmIyWDZ3eE1xdDZCQXdVRTZnV3FFSHZJSkowdVZDQ01VUnlXSnh5Mm1qSTRw?= =?utf-8?B?dzBhY2dxZlAwY2U1V3ZHYm5hY2JIM2hLTk5hVnVxOVNUbE5jUmtqdU1NOVJT?= =?utf-8?B?dXNtUlpaT242b3Q5SlQ3UEIveGNLVWtnSUFHVXI1MHRramE5aUx3U1ptTU85?= =?utf-8?B?dXVOQ2RyMVpNTktiaE9BOXhwMnhxM3B0MzlHbkhWaFRFU0tFUGNHbzVoZG5m?= =?utf-8?B?c1JtNVc1TUp6UGJITGdKSDNFeE4rK2k2QnJzLzQvam5aOG9EVzhkaVBFd1JG?= =?utf-8?B?bmdmalZmVGNNcDltMnlKdXJFVHJ4U2MyWGhvWlRHdnY4Y2hyM1Y1M091NktN?= =?utf-8?B?WmFUdFg3U0pBTjQzN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077ognidT9HslPnqyLLPN0a3YT8SlqpTzAm2PdFSvZRo+ltQwOaNERMWYaCt05dG6y7smE14Fv9+nHmURNLHXsaxQ==; 5:yVnkYMdgd7vlHRHvbfrB2b0FwGsWcxsCljjoFuvUVaKXSNcIM8Tf3bGOAW7vCk1NTfPI5296zor7m8LZ1Ulld91Amj6YYqsH8k9ai42AJsjMfDggwMTPykp2XvwXuCdw9+qUfHmj8fbNrLqlM82XJa/Ntoe9NoA5PvggvEFmvyc=; 24:XLzlVoyk/pXVW4zyH2EfWZOO7uoHJQwmfaXKyJm8mi4gtz5FuhLSvbERHkW98XuCknVWaODv4bs0g/cXSKEpuPy0PIzPvd/x1d0gndFLYZ4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1341; 7:vPTdMr4OaDlcruasn0xQRM/WeJFYeAOtRHyjRW8yIyZCSy3nLU9MCpZ/vL5Bpy2hlZaxUaZT8nt8gPqlV8aHWuyupanVsuHAAYcGjkj7qf3o/svGIbTm+2aQH04GJRQ8taxRyqTkzyptLZNkomlUZjnoGzd4mDLqGph0dPB+WgH12XXt86t2JLU1W+1llRJ8oWYrVlFWaXsBxU7jMxXvQy/wh32H4HAy0Z4pnB7B0S2QnntEM27TR0eJ/FsllZ5X; 20:qR9/n4h8fi9hI3AlWkeUTkWwHzGYTCdT530EbkIvCtAlT0k2BDzFv4ZxtrexdqBRFbqAiTlkPTV1MfN9YyN8MbK8Mkfq0AdKwHtwFH1rosslqUd8AukXhnJ4irlURmuFPml9RZrUU2cc5b43Y4bUS432AcHiLdwqSDx+y/EAtxs= X-MS-Office365-Filtering-Correlation-Id: b494585b-0d92-4f4e-e60a-08d5bc9b83de X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2018 08:44:04.1637 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b494585b-0d92-4f4e-e60a-08d5bc9b83de X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1341 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 f09ea20d7270..2fbf3b476601 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -373,6 +373,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: @@ -544,6 +558,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, memcg_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 @@ -573,8 +648,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; @@ -586,13 +661,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))