From patchwork Tue Jul 3 15:11:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10504347 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 2CD9E601D3 for ; Tue, 3 Jul 2018 15:11:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18F2528B30 for ; Tue, 3 Jul 2018 15:11:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B5B728B58; Tue, 3 Jul 2018 15:11:25 +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 5990E28B30 for ; Tue, 3 Jul 2018 15:11:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18FE66B028D; Tue, 3 Jul 2018 11:11:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 166616B028E; Tue, 3 Jul 2018 11:11:23 -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 0578E6B028F; Tue, 3 Jul 2018 11:11:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id AA7FD6B028D for ; Tue, 3 Jul 2018 11:11:22 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id y16-v6so1092628pgv.23 for ; Tue, 03 Jul 2018 08:11:22 -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=jRh30aXUuYSNi62j8dagIYPTujdTh1UqhBqbhgbb8H8=; b=hn1gxNeT7KhpOGVvW3cMUwYAnNGFORhMFYnPeEHGAUVCDDvyymeC2dRif5Tplj7sIL Y1yiioV57cHK0QjbtqCE8rpxoPKoQ/Ju5jjWjCLnWp0PISbG21jdaULuVz49lD8/eOpS LyNPjLpmmhcNX/ONmvRNGloiG6w2BNGwuUxOv0lOMrtMShSBpyZb/+4Fap0skqv1lhcS l/bhnc2cqL0fkDfJvwqEYhuam6NWDdICV9GWF9OX+9bvZ8mj3TTspe/hT+5sckJg8k7I 9UM2accNmtsRIyXlXP5xPZQw1tA9nnriJqQwOHI2qyC5mG1JAuCor7CVUZ2tqjA42D5X u/tg== X-Gm-Message-State: APt69E0Gql/cEKU8DiiKUySCCExyNV0uCgEl7nRQJR1HoZo6IOpZkywi EvxO/u7dZqtSMN1ZIr2aIDDeOuGdXkk+gy9mg1ACVG1bDy584CsPiUgdZlQieGCOvA68KmOzx4X 3zEOnVANG98zDolDLzndRlC54WJTK+L/5/vU3W8JTMw1lmU5YmVlXIYtFi3adYFnzZQ== X-Received: by 2002:a17:902:758e:: with SMTP id j14-v6mr29876318pll.160.1530630682357; Tue, 03 Jul 2018 08:11:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK1ACkpV5E/+UZ912UpFtsplav/yar4h3fJx8ExxtTN0lKRCRkWIu+XfI5Njs0UdP03/YOf X-Received: by 2002:a17:902:758e:: with SMTP id j14-v6mr29876249pll.160.1530630681289; Tue, 03 Jul 2018 08:11:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530630681; cv=none; d=google.com; s=arc-20160816; b=NThL6SX3G/GKUtizq40KLE28Tru486xItJufndMUVT6yNWgdw1LoUrX2U707l7fXhY GYT6VN9uue4r8Qe+pQ0iq0p/HBJmxGa2/T0sr/ILlwnvfz1RnOsY88ex3aKmbSJX8ab/ e2yE39N8H4M+ihXZC0+eir23WRSe/cz/16MaWu4RvG+4Bl8V9S1/xS5AgA/SfP9VHmlL c/UM6hId+BzojYgCWvjNHOz2sCi2e+3WcBak2CP2eSQqXgbMeKYvMCSb6S2mXqIkpvJU rAKzePOHXPcyJXhRDP8AAHJOG4kREzxbPHL1f5icqwtJSRt4D8ybLXD7Nq0BZ9Any3xY 6DlA== 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=jRh30aXUuYSNi62j8dagIYPTujdTh1UqhBqbhgbb8H8=; b=mdiyQeUEVIQRSg0o9PE5bnr/66nRK1w5NvaIaWhBnaCid9ujl/97vvC7YcsBwUN5op 8ePtVXoiW4ZhfxJEhDxrAyf55Hc7vFH2Okwask5421026JTCYtxWepya4ONcr6v3aEa1 yVmU/4YRQIKeR7DxDwJqR89H+9/WmhUnoDDThNPi4JmgKiLrtDqQNBR7mOhnJDuTO1T3 NMBG6r7j2vh+B230vVseiV/BOXTCLVoo3IzdakT/sC2vixyPp4nAMVvjlHzdXHpkoOoM h9qJMcfSrMV47NI/W+dgnosbPRivPYWItQOJytemj+9mmYRIK0Vr9F+1CI5bsGd0SCA5 H2wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=EGWDrrxQ; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.4.93 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40093.outbound.protection.outlook.com. [40.107.4.93]) by mx.google.com with ESMTPS id j10-v6si1169274pgq.503.2018.07.03.08.11.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Jul 2018 08:11:21 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.4.93 as permitted sender) client-ip=40.107.4.93; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=EGWDrrxQ; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.4.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=jRh30aXUuYSNi62j8dagIYPTujdTh1UqhBqbhgbb8H8=; b=EGWDrrxQ6HtQU69E4rGnb578U0CVbaoEnt8q6IlRRNqEvEduImuu9rxM95Jsi89q8pmZ6o8GtbQLCslIQdf+hKiHXHSRBd2Q62m1CB+MTYgSvvrzsalF4wco6RRE/o8odMxiL6M6eeHyE61JWahBiYlZw1/E/IFCR1g7lopheFs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.25; Tue, 3 Jul 2018 15:11:15 +0000 Subject: [PATCH v8 14/17] mm: Iterate only over charged shrinkers during memcg shrink_slab() From: Kirill Tkhai To: vdavydov.dev@gmail.com, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, 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, akpm@linux-foundation.org, ktkhai@virtuozzo.com Date: Tue, 03 Jul 2018 18:11:06 +0300 Message-ID: <153063066653.1818.976035462801487910.stgit@localhost.localdomain> In-Reply-To: <153063036670.1818.16010062622751502.stgit@localhost.localdomain> References: <153063036670.1818.16010062622751502.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR09CA0043.eurprd09.prod.outlook.com (2603:10a6:7:3c::11) To AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 043a0641-ca12-4276-87c8-08d5e0f73a2d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM5PR0801MB1330; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1330; 3:ocdvo3jBnLhSleeMCvVDCMB54BN94PoFBvQOqhMJ7ae9j00YHNQbqiS6Lqo366vITjIfhYJcKSxW8v+8OTHviuIHkFwrvTuCQO6JQqolUdmHizYLtu5lZUroBgDAO2xgDdzK//ShBbiT+BRX3z7I+kwxHmvv10HRs/BikYFutji8XXZ3In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+mnCFsG+vno1+odqzSMqW3t9gEgljmB6gs88+DwDHH/IWcmf20nT/enS3WG3bj1igLTNynAf3+7lLcVVIE3qL7A04jUDHb3XUwgqyNd3Sq7r5PATkqwtbOLwN07vU0twpksnPrBcu2wgT3Yw1CDrmw9MeXAtxQUjRD8qBFZU+; 4:G2MnAlC664sP61j7AtYQ8SgkCzmKDSSMuMxBbbs9oeD9W5sgOOuGhOFNpoZBsexNM4Byoav3AnbZ81BjRUqj0D96ZN55FzHEcLYpPsskfz/2Z4qwn/WW4aWfKnZi0JRSrF0NQ9n3PuULaJ9+tARkMklBa1vjOOZY9vXCOauSLqJC1Y8JYitoizojeT2yViwFq+id5tQuzC2HQdJsFzK3JXmfRoIITA4IoGEDsqzy5zJqw+QF7zZXjlUJuMsqy8r3940Q7ecxh3ZTR2Pq5oO2h7n2XTHmNwVV4qBnXgpDfoCAKR4Rq6nVhFS/dOxlRQEEThCKHzO8WWUTyQZmOLm+vzYXt6EYj2eY37GdP36K5mAceUFSX8hGj6dfXOpI6MKm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(85827821059158)(211936372134217)(153496737603132); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(3002001)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:AM5PR0801MB1330; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1330; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39850400004)(136003)(366004)(376002)(396003)(346002)(199004)(189003)(26005)(61506002)(6116002)(186003)(16526019)(305945005)(86362001)(68736007)(3846002)(230700001)(7416002)(6666003)(97736004)(2906002)(8936002)(5660300001)(14444005)(25786009)(103116003)(316002)(956004)(7736002)(39060400002)(105586002)(55016002)(106356001)(9686003)(66066001)(50466002)(478600001)(47776003)(76176011)(11346002)(486006)(52116002)(7696005)(23676004)(81166006)(476003)(33896004)(58126008)(53936002)(6506007)(446003)(81156014)(8676002)(386003)(2486003)(921003)(1121003)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1330; H:localhost.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtBTTVQUjA4MDFNQjEzMzA7MjM6WWV5WHN1d1hsS1VlTFRUNjNpZWFDaDhP?= =?utf-8?B?cWlqMXJlNzN4OUR4RG5teWtiOW1LRk8zMXc2K2ozcU9LZUhoSXFCYTdpcWFq?= =?utf-8?B?bHhKYzVtZHQ1anFZcVQ1T2VLT3JYSHUxc01scyt1ZkJia0U4dmFpVUdjbmk2?= =?utf-8?B?bVhwbm94QzBWdlVRb1hKQVAwRnV6dGlTUWlxelN2TS81bmJIU2dWUFlXQlR0?= =?utf-8?B?eWYwR1M1NmNSczVZK2VFRytOV0c1K25OR3VjVktEdzJlMEQ0RUorR0NSRmFr?= =?utf-8?B?dzNScDNtNHV1R3BKSFRVT0owd2g5cDZ5NGFab29RdDFTNjhzTVZWVTZCaHNP?= =?utf-8?B?WjRUdGtkTE5EdGZrQm85djZTZ0Q3c1dzNEY3aGNoeVB6UVd4Y0hteGp6ZWhu?= =?utf-8?B?TS8vK09PckdUamh2eThoSkRaSFBXdWlmaVU2MFdjWGFWQi9pT3ZRSFFpaXZa?= =?utf-8?B?dkg2SlhkNmwyU2QxQmpBRkFvVmIrK0ZkdGJaQjcvdnFTUjB4VkgxVlVqcFd0?= =?utf-8?B?ZVR1UW5iZXIzNjUxSmF6VitLOHBNWEVEL1BqNDl2V3N4eFB6aE51d1crU1Az?= =?utf-8?B?dG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b28QxFINtYSKC9eMS/fUchnMB5m5CLNtGqUIKjtk44HcdhUyuLKKotKjqTQCblWQv0qJ9YEt79xJj5k1rXMk4sbloXIyPxi6Hqw/QuZqGpfYosND7xf91JCRQ0hGQ+YXj9/LHuG1W6fc0G3xa1wDE17vmxGggg==; 5:jJCHLqbCH0yfN8+UphYIt1SCSeqOW9UypLCVxzBXQKBDW5pwm3C8YbDz1H8WDuPh3N47i0SG/2Nsq1lZE+4GCs+9+DkkZ+T4dKrVuQlZ21VkIVMnULXj1w512DvnTbYG3V4NOt7Dw9eFruYpshIF3HPxpLN5NBn2564V93nc7Ms=; 24:ETb+Qr8a2b+Mhez3M/Ir0Yer4rFZ6T+pR9NmpFPDPl42pV8Q8MvUNs4TdCRW15T7zOpTsNER6C+B4Goo1qbrlzwjDXjIvKD+3FjI2t2cOzI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1330; 7:tM8CYkfXgmSfsUMA/o8pFcY+ISbpv1r3e1PrIJYkAcc10BWjw6dgVknOVF0R+S/MdbzvEfI2Jon0JlfqZnUjijWsI5zAFafrTv94TJH8RGSYMq7zsDJIcmQVC9L+h1Xg0IUT1ewXwuhYk7IbSDMBnX9zu9ZEiXhSBu2K4ieUyYPOHQJ8NWUSFEOhzOyhD1kZIbzvD315y2/u7iZlC/VFRHdYNamzJL2Ukvlh2y/fQjZRdjv40qafqiOBOrHIY6A/; 20:yt7Lz1+jOv94q40stwiKpNTOJtIo6YlD0w71/iI8AyozwFg6T2Xyb53+DyXhCXY/UE50bj1JehXMptv49bhZpyZWHbfMvOqpgZKyTk7kpBKx3GUXqXRigYKC0sHX9vxuAAYGZKBeUZgcP/28H/YOunCCxat4ZLJqPvGOwj13jW8= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 15:11:15.7699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 043a0641-ca12-4276-87c8-08d5e0f73a2d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1330 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 Acked-by: Vladimir Davydov Tested-by: Shakeel Butt --- mm/vmscan.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index d8b1958c751d..d4c40ed9ec5d 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))