From patchwork Mon Jul 9 08:39:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10513981 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 DABE2603D7 for ; Mon, 9 Jul 2018 08:39:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C44EA28A5B for ; Mon, 9 Jul 2018 08:39:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B78DF28A5F; Mon, 9 Jul 2018 08:39:56 +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 06BE228A5B for ; Mon, 9 Jul 2018 08:39:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEFF76B02A1; Mon, 9 Jul 2018 04:39:54 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E79116B02A2; Mon, 9 Jul 2018 04:39:54 -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 CCC156B02A3; Mon, 9 Jul 2018 04:39:54 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f200.google.com (mail-qt0-f200.google.com [209.85.216.200]) by kanga.kvack.org (Postfix) with ESMTP id 9DED36B02A1 for ; Mon, 9 Jul 2018 04:39:54 -0400 (EDT) Received: by mail-qt0-f200.google.com with SMTP id o6-v6so20835750qtp.15 for ; Mon, 09 Jul 2018 01:39: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=6vYlHy0Pnj+SEEOP+jgsRFUdOfc76+E+1KUo7Gtg+XU=; b=pNAQysUGT14Blnid4QQA3OH7snqsvraik1FNSrNdqAlPP3Ay1haoRVbFluySPiTzu+ 2cMHQ/3ipS9O9uO6V96g9neNgRVcbnpb4cpXL3R2fRGqXvBGazz5keU9Vdq2VBHHjuJf czf8dALkMY67y9J/xj5RuiycyZtB+PTVKx/qRDY8H/HWeWxG6/kjD/NNAX91LPrhmltA toSYiqCXPvzlruD41pHTQMTXglnwJditeLZjM1FqlxYAtziwVX+qEhZGFhuqDbu/gdi9 qipK3GX8DEHcAQoiZIe7XqxfIEkPnshsWWhiO+LfTMm7zHSRBHrl93m4HOlIHp+prkyj ZVAg== X-Gm-Message-State: APt69E1pLdloDYpSA2YlO/DykzDWEKlVgP2iM9spxlE6zRXNWNRmqUpt w8hodlK7VAVbxNxq/QRB7Cj5kE4qk2o60seMBf5DPveEPTkxKTGmZT37CyT0mNRsbiRQttt46hc gt7WtPF4M2zyG4KOUsexdo3f3yOBZ7ejCkf1ozdvEKKHo6Ufm2SJcro/mawvcFK3ORw== X-Received: by 2002:a37:1f5e:: with SMTP id f91-v6mr16634787qkf.234.1531125594420; Mon, 09 Jul 2018 01:39:54 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc5n3P13nml6Ziho4Umxb/zpCT3bUckDTZbQj1ac0p4bhLUPyBGbNDOJXl5dvbNprP3jjGX X-Received: by 2002:a37:1f5e:: with SMTP id f91-v6mr16634771qkf.234.1531125593747; Mon, 09 Jul 2018 01:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531125593; cv=none; d=google.com; s=arc-20160816; b=TtR1AZ5MQO951lTrkHjLT2YS/TGI13Bd92vhDE9+l0dJZdS3ksHeKjeTpNljPOofO9 X5mfEhHUEeqUxOnRi2oQC/b35V3TA2Lud9rY56sb1cMz7m693f8uFW1cxigvku87QWoV 3gEC+p3CF0osQY1wGYECgTjrvwiblKbG3p7VRN/k/5kDIg02kKe1aZXcs07CBpj2wMWg rOCYSqP1jrmAwvMREcFWin0BMemO5wFTQwSsYbAYcMa7T4PTaCb/Q0BKRdowtlKfzP7D Pod/QiCalbkdEhz4kW6nqPkN9Dg0Wvwk9YpfO63hd4TFz0XUfJz8z8XmEt7tPlS8JLe7 rBDA== 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=6vYlHy0Pnj+SEEOP+jgsRFUdOfc76+E+1KUo7Gtg+XU=; b=j+SFOqEiPAQov/D/AJ52t2Yvt9ZVecEZJsW7VygUr/LxUJob0QEL44uhIqW5aMC/zl z8ouJ0z/P+7o1MPJfDQQiuAKazqPOHuSs5+CR0AKzRzsd0qvP3WaDNAXBGxREDOXN0bR lLy+HXLvIwWZY4a8yT6SiUloNVNY9/9OgxweRegJtp+xAblhnOt7TKRIlZShBFCLndzB Wqqwet6uG1yVYdmDUrWgiazFkllqsNRy7yWHcfc5OmQncQAtXGBest8e2QeFyprzP4rQ m7T7F2UuU+m4rbYoKou2COUWrJXNImNcM690b65UBUtWf9ZSwslUvgE7fx7Wq5/rSQg6 B6sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=T3K72tVN; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.7.109 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70109.outbound.protection.outlook.com. [40.107.7.109]) by mx.google.com with ESMTPS id u26-v6si5187898qkk.140.2018.07.09.01.39.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jul 2018 01:39:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.7.109 as permitted sender) client-ip=40.107.7.109; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=T3K72tVN; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.7.109 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=6vYlHy0Pnj+SEEOP+jgsRFUdOfc76+E+1KUo7Gtg+XU=; b=T3K72tVNqgQqtNpp1S9Vle4GZeofdtNkmEZJCz4heqxos2NKpJC7Uu2y/bdu3EOxRjVKu8U7cx7TyOGehY2ERpXmYlVq5vKUN6UvdccdwXQDI4P76wF9d0s7SO9zl4h8UgaFn2D1I2rT2KuU9w3JzMiY/k83ZfWy7kXD/njStIg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by VI1PR0801MB1344.eurprd08.prod.outlook.com (2603:10a6:800:3b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.21; Mon, 9 Jul 2018 08:39:48 +0000 Subject: [PATCH v9 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: Mon, 09 Jul 2018 11:39:45 +0300 Message-ID: <153112558507.4097.12713813335683345488.stgit@localhost.localdomain> In-Reply-To: <153112469064.4097.2581798353485457328.stgit@localhost.localdomain> References: <153112469064.4097.2581798353485457328.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: HE1PR06CA0140.eurprd06.prod.outlook.com (2603:10a6:7:16::27) To VI1PR0801MB1344.eurprd08.prod.outlook.com (2603:10a6:800:3b::8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f72201da-600c-4159-bc66-08d5e577890d X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1344; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1344; 3:khmk7QGE/vnup1RnyNHbGa17IawO+SFauoKLw/Fn22iVWHbzVWMfVPocJgNeTtOo/IK0qLfe5K63WNOmhAWIrB0Oa4XfytmNfqpud4svDf+5wWv2oUVt7kLsOZ00Ggd9I3hyD9+OpfW/UCWI/A/ed9QmuOszXEi/Gkz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WN4FYIoEWXhiegKs5Rr+y+L+aApUlsTPGpAmpH2r7c2gpRSOLcZgi4YvcpPHV4m8WQrYFkvg3ImWP7roMOH86avHVdVY9cKFTJxG5g3SErfgwvCIMOO8XS0sljq69zQ4baxTc4g5A667BqP7vq23ld7JzBqGkZgD67eGX9SIBwRee9OENVp6YRb3i7x; 4:KoZak0iyowso7t9k5il460vkw8pp3YYkbsB8L/lWuw2yk6tmp+gztxGo/jBth12/93ibH2wRfzdcLUlVhsQMZ+0rmh91eBDgCt5Pep7u/oJyPY7PnsPiffb4md/2OQ5YK8uPeH72tqtT1RT6NKy3qYFfOmxhRFBen7atIgBtJCyDkQd3pqr01jwZ6ZMGyGH9L4UouhIj3vHu0p4W2Y4AGLlu9T9jIj+j8KwTalAZrhZ2vk229Ke2E1tbKbpq9AOoGd2xbhTgENe1jdoiMlgTFodpAp6hGo1ETXrMQq28F5bOd++bmHYpcblwNpnkMmwWc+SjrzOsfyOnyH549tG0YpY+Fvv5irViGVUicHn7jbPN1Axubyb5q+Ybm1ibFkf1 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)(3231311)(944501410)(52105095)(93006095)(93001095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:VI1PR0801MB1344; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1344; X-Forefront-PRVS: 07283408BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(366004)(136003)(346002)(376002)(39850400004)(189003)(199004)(2486003)(7416002)(5660300001)(52116002)(7696005)(106356001)(105586002)(7736002)(305945005)(2906002)(23676004)(68736007)(25786009)(86362001)(14444005)(58126008)(16526019)(186003)(97736004)(53936002)(6666003)(486006)(50466002)(39060400002)(386003)(6506007)(476003)(61506002)(26005)(11346002)(76176011)(956004)(33896004)(446003)(47776003)(66066001)(316002)(103116003)(9686003)(55016002)(230700001)(8936002)(81166006)(8676002)(81156014)(478600001)(3846002)(6116002)(921003)(1121003)(309714004); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1344; 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?MTtWSTFQUjA4MDFNQjEzNDQ7MjM6d1pjNkpHV1M5Mmw0T3E3Y3gybTZXNkFP?= =?utf-8?B?OW43SnNzM2ovTHhrRTNYM3kvTlZzRjFJNkVBRkFpQ0dFbUdGeVdZKy84NGhn?= =?utf-8?B?c1VQVDNZRElVd0ZFOXdIV1M3dC9LZkpWZFhwSjRYb0tpczRZelU4b1RjU2Y1?= =?utf-8?B?ekxWNGJNbDV0clJsZEdaOGtMR0k0V0VPY2hlSCtYaERDT0ZsTmRZOElrSjN0?= =?utf-8?B?Y3JzL1ZDbDFmUWg2cDZvSjhUZURkcVV1YkNWSW5UU09YTHhnUlRDb2RraDNW?= =?utf-8?B?S3dZbEtyMCs1T0dKYllRTVBTVENvd2k3ZlViNjc1RnA0K0dGNGVBbWVZZHR3?= =?utf-8?B?dS9jRDRMck1QVU4wc201S29odDVzajVMaUdZdEVaNU9EaDJwYXk0cGQrSGda?= =?utf-8?B?Q0FpZGFKejJxRE1GUUhJODJNWUo0NDlRa3E0YVVjb0xod3NFRElnR2pzcnVJ?= =?utf-8?B?T1lmR2U4ckJsSUhxc05TcUR2dHplNWFKcXJodm1EZG11WEIyQityakg1dEMw?= =?utf-8?B?U0JIL0kzdys2QU1ZQ1o2NEJkUitLMmNZV2pFNEdzeE4ySEJ2VHN4dHQwdHAz?= =?utf-8?B?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qEotcljl7RlRDyOC6mimhdZPtvZEEpoMNqJiqYL6F8/UZzON2+xsjfElRmjvr3pv5gI5RKUzOWwuKDwAnfepfqp5JqcC0KEQw/Hn17XwkYXdwtVZ7yQaT4YUj5jAr3xz/hmPELEfMErZ2AveV27gh1Q5Ee875qRZzug==; 5:IomnAY2vqLCMd2AESLawhdjlaEhfOLhFI1U5ClAEkzAAjyRWkVVK131gcTSlAv1FlB6KLkugidD3cyiJ+Qm1IYbk5+lFJ7vVwFQxpOpuoDTxzcKBq8f+vjUyvLwIe4RVya/D1qT65mCdrFxFb3xdVVnj4JLhYdZscv+qSnfUywM=; 24:llctBe4bEO6ZXQJQLNKdtJZuUD8SC69zZbVpXtpF2OHusWG5Bj3ClwAWr8CDgl3LjA2WkPojPmYGBiMLf6ZthP8GV8YlSX6pZGhFIivPusM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1344; 7:+ObHeaNEgFniW1DWsqrkUpj58SXAtIOkSP+QVsS8YH5IKGi/IaBTroUEwMgYp83zu7LD/Sa80PaEjLnU0l3mBXSuI1v1viyEmcAig5e7BSfsx4Vd6gXdWZTB2j2ivja1S9czPNnxaa5EbhLVR+9VnM0FowWbmxTknQOcDQ//WbMAhNh9BGEb1LuWMo3RvPJ+/ylzp4tqt8fnP6OATj4ucuYM0iMape+LT/NDgKSL9B9j1oxjQC4L0BrD34wjjOgq; 20:ckKCT0skUV1dRCrPvRc7FSr2IwRgoViLPfHe7/ygFFrtKwx7qlivDVbnsVXIK3NcNYd7vbWiaplR7FTgjz3BilB2rQsY/CahiK+1MEfRcoon1pi7h2MqTDJ2l/zJZUt/iKhCdoAcxD4egN6kXSwp1cOHAD/y0NlvYTk/3ZRaGsc= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2018 08:39:48.0889 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f72201da-600c-4159-bc66-08d5e577890d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1344 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 | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 75 insertions(+), 9 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index db0970ba340d..d7a5b8566869 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -364,6 +364,21 @@ int prealloc_shrinker(struct shrinker *shrinker) if (!shrinker->nr_deferred) return -ENOMEM; + /* + * 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); + if (shrinker->flags & SHRINKER_MEMCG_AWARE) { if (prealloc_memcg_shrinker(shrinker)) goto free_deferred; @@ -543,6 +558,63 @@ 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; + + map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, + true); + if (unlikely(!map)) + goto unlock; + + 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; + } + + /* 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; + } + } +unlock: + 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 @@ -572,8 +644,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; @@ -585,13 +657,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))