From patchwork Thu May 10 09:52:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10391511 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 0F1C660153 for ; Thu, 10 May 2018 09:52:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F061E289BE for ; Thu, 10 May 2018 09:52:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E42FD289C2; Thu, 10 May 2018 09:52:31 +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 1B1D3289BE for ; Thu, 10 May 2018 09:52:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E91D36B05D9; Thu, 10 May 2018 05:52:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E40F66B05DB; Thu, 10 May 2018 05:52:29 -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 CBAFE6B05DC; Thu, 10 May 2018 05:52:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 79FA16B05D9 for ; Thu, 10 May 2018 05:52:29 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id s16-v6so920846pfm.1 for ; Thu, 10 May 2018 02:52:29 -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=ZopJs9YZJ5AStz2kEP2x8LdjSK1V6Y3zwOESzDJ3U5w=; b=dOaYd+rQPpYQd4pBmGKKasaJo9oTPjmA7kYLR4vhx+QrGAhUCsoklxbEFNKp4vaOOw Zv5U/FW0AHtSuDoh/qYu43Z8592KQhb4YZzbQ1yxCg4t3AkZ6INVGCi0HGrKQA+92h1g ImfWK9YuYiHs7VYyWWNS4OTWwoRyGqZBN01funZggUsn2BjsfJj/KkuZDputX1Gc4XmH jSJnODlP2+XeTPD810knO4ebaTkRvdlL2EOgDjYac1fnFmjd3i0XGyJ8W9VNAnio4jiY BX3KAzRQXxOMlWcdBbmXRFQjWovBWJMx2UtZjx/H7zWdYP8f0ZAupE9G2U7QzuqhwQ79 fDtw== X-Gm-Message-State: ALKqPweAlpX3upbKmwb6zx41LevmvyspMhXnmTEbcOKB+DNeHhWve4SF tyrmP7RIps2nNKqf+KZQomfmsQ0F7Ai1TnI4zNIuskWGI2cwV4o+F+YzrqY8Bp8nrbIC78/fl4F crsKcZwBqqPIS6wHqBvm1FW5nJlC8xXxT8rB+n+On5fVtp6l4V0YV8guxNxHMKfCB6A== X-Received: by 2002:a62:469b:: with SMTP id o27-v6mr720619pfi.124.1525945949178; Thu, 10 May 2018 02:52:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqTO4bEPZpBtS90VK/agQxgL7II39iWqQrMnPO5hJ0eYGJrtPYe76HTnsdQqn+BgzFBQdCl X-Received: by 2002:a62:469b:: with SMTP id o27-v6mr720583pfi.124.1525945948237; Thu, 10 May 2018 02:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525945948; cv=none; d=google.com; s=arc-20160816; b=qqEIoT4eHklAfRQhp3v/yqKcSCR7v4GgYu6HQUG/E0/0hVsQ9Oj5Zm1Dajtr3JI41P 9yvWHUlxy50ZEo46GgYhQWGfknaDfyXvCn+WYIVvpBX1W65fd0NWVSc/RgJqL71/tM3/ vO+X2nVny6OZgtva3kJh+Z778iAyEcsNJYAEg8P3hdG1kHzEGIjBRW8voA9snn+IMDrm Vmna/fDUKexQlWtpa8GmxyStG99/NzGEi3JVPBbgFS7enbQQjY9O3JSQJC5HTkJG3x78 0QjxC9FEAsQJNdm+onHpRmHgiZtOOF/1SsdEWndj/5PBdwFXURIJynqMPBTxqgtfzutj PWyQ== 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=ZopJs9YZJ5AStz2kEP2x8LdjSK1V6Y3zwOESzDJ3U5w=; b=EcVgbZoMDAowvv8U355qnPidzvp6JICwuJC4IhaVFy1uF5G3g1iXoNaa8EDVxSetsM chyyr1A1QBBiVHHErTkBUFGDQTpX5/jGXTfOf1EVGN2FLdcuXrf6h/63CKwJDnPBVTAF CHANT7Yy05kWLrWj9iXBQ7ri67TlEYvJ97yVhpHxoy1HV9WPEHN9Y2YywgQaoPo0Z0lK bml0gGO3neC9m/CyjSG5Zk4EaRxYz3ZnavloeSfGDuFXSv2/BoGdRIiHmPKL0ZuCpGaM alkb2iHzDElH+NlAIWMJbpBoLHsflKCu3i7c4e5G2HBAMRUi8K3csM7NMA0ErSeMPXVL wpRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=C0JTtU2y; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.120 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-eopbgr20120.outbound.protection.outlook.com. [40.107.2.120]) by mx.google.com with ESMTPS id v9-v6si367113pgo.483.2018.05.10.02.52.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 May 2018 02:52:28 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.120 as permitted sender) client-ip=40.107.2.120; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=C0JTtU2y; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.120 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; bh=ZopJs9YZJ5AStz2kEP2x8LdjSK1V6Y3zwOESzDJ3U5w=; b=C0JTtU2y4bAUVMo+q7lDV18plyFC8cS+29Ta+awDc55x0x29bT0sHqf2kHxGGLcOaXRtUDVOI3+BcZvlsLiUWO4oWOSiWar9cBJvJn84yzzOASutHAlFWMF+hN7TM5sE0LzANiG7Apk+0dg7ujf84KE+KkEruNtOGhBJjmn6Ybg= 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.735.17; Thu, 10 May 2018 09:52:20 +0000 Subject: [PATCH v5 01/13] mm: Assign id to every memcg-aware shrinker 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: Thu, 10 May 2018 12:52:18 +0300 Message-ID: <152594593798.22949.6730606876057040426.stgit@localhost.localdomain> In-Reply-To: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> References: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: AM5PR06CA0030.eurprd06.prod.outlook.com (2603:10a6:206:2::43) 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)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(5600026)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1342; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1342; 3:4ewwDEueiII8n9qLdcJYEci53/q9cj63g824EwxG/5ZyjVxVp25KQMYKqjy/PfKkYISnIgMu0Fsh/dL3vXfyyE+9txtSRO7C0meEwhV8mG0uoXq2DVQ7JL6h2kzAabRfbE4cZwARsS1ZZiEjtNMzbvlITzAhFQVVgppxZ6WnbxqjpZjPHO+2pl/OwEr6plK3pGztmTANmcV0uBeNd7Ten9XSwe7Lc6DgPqnDx08JwZSSJAsERQoznpOxu/r/TSz5; 25:rbHRUT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1p/Ed4SY6za/JoEqgapS2BSzQu3vggkVJw080ByzOmzVJGQj2uXiLgZUotP3z77QIMkKtB8kfdZI58fWB; 4:IQGPSMRk/MaiGT3SUlxWoFDhtbXbs22ZqmmwAjGGOfrP7l8W9OVsPET62+ZCZLhJ6jJFVFyLmkEPgwJ3tNOUg15ENn4ainveyWTiX+z5IAgOkBoSx8LBK8yhWsnlDKTbOxOknWm/wXr6Zzpbn0RB/+q84TbVWs8N5poAQ/y9VmTQRw2VC6UgJA1r7ox2KhHU6q5pxJXlRFP67H11avzZASmPlZ2PkPSoDbaoYXCEdb3XJxCA6anrX78P3vihT0/serPA7USrUqw9ziNZ58shXQ== 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)(5005006)(8121501046)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:VI1PR0801MB1342; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1342; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(396003)(39850400004)(376002)(366004)(39380400002)(199004)(189003)(52116002)(23676004)(26005)(68736007)(186003)(2486003)(6116002)(97736004)(61506002)(86362001)(3846002)(105586002)(106356001)(16526019)(55016002)(66066001)(11346002)(446003)(25786009)(486006)(7416002)(76176011)(8936002)(305945005)(956004)(478600001)(7696005)(5660300001)(230700001)(47776003)(386003)(316002)(59450400001)(39060400002)(476003)(2906002)(55236004)(7736002)(6506007)(6636002)(58126008)(53936002)(81166006)(9686003)(8676002)(33896004)(81156014)(50466002)(103116003)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1342; 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?MTtWSTFQUjA4MDFNQjEzNDI7MjM6V0J2RVZtT0hSa2xldElKa1NYSUJudU9y?= =?utf-8?B?ai9hSGNyWXZXREp0a2dyTTBZM05aUzFLTjduaHBETjJYMXpaQ3lheFJvTWhq?= =?utf-8?B?ZW1oTE9TdEZjR2Jqb3hhaE9hc2x6aWRLMFZGZWVPSXpmbnpIWVNPeHhaKzBn?= =?utf-8?B?a0xyS2FENTNIMW5Ma3dRaERYRUNZOFhkM0xXa3A2V3ZXM05UbS9BRm4vbyt0?= =?utf-8?B?Y29lL3pVb1hQVzdjNVVRRUtCUllBMkYrL09vc0FWTlhvRDJRaWx4MnZXVEY1?= =?utf-8?B?M2lZYStsaHNOSWxHaVNQd1RXenI5UjZjd0Rxd1dDd3BFeDNwYU5iWnprMTR3?= =?utf-8?B?YjY3S2JiQ1U4TmpSdUlUSitCdEc5Q0dJYXM5TUc5a2lBWUdxd3dIR3E3ODF3?= =?utf-8?B?S2lySmNneld1LzlIR28rZ0Y2bGtFbFVpTWlBMW91amc3NkZJYVNtTmpXeDZN?= =?utf-8?B?ZXZpd3liMU5mZGtFbHNST3BQcFN4czdiQVdacUxIcUdKVHRtcjNhRm9qNWRE?= =?utf-8?B?R2FZV1R2NjEvUW1Fc3VtZFhMWEVRWVdRWVR1TkNsMVgrdFhyTUdqZkdMUTds?= =?utf-8?B?Wkl4eEZxOUE0VkVWaXZ1THc1OVo2RWpVdDM4RnJtaDVBRUUxcHJFNEZ1bExL?= =?utf-8?B?TFI4V1h1R0xNdXFhMkZMck12MGFST2taZkdqRlRmK1FTWVdTRXpScGw1eFFr?= =?utf-8?B?dkJYa3VNTHcwSXZZR0dsVWxFY2VKaDYrRGtYWUJoVnMxbW9Hd1Y2dTFRcXgw?= =?utf-8?B?dXd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5eBe7pbJlk0mZIKR0Rb6v6EkJE=; 24:o9c/CUEb3rW/0vGkw0pfQwAC50+sBNph2HSX+3NwoDgOvXYtEaLHNsnBhusLTWrUdVYXp8dE3srIl2CNSzhPnw9zuq6wvB4n2WK/LsBdpdQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1342; 7:6Bj7BnDBZzmjdYUw/z7qn0IDV7veFAxAWZqJVs29wV0RuBa2NAa+H/c11v8NCzOtFdeJ8qCnVxfRIVTzBnEXR71F2ARoEAiaofAC3pNi4KvIsR43h0tIYwsV877BP78LI2cJUwVges/jSexAhb33AvxgTSGNtsqa8WtlCU0XT4TxOqsckh/0DID8rxkZWLnMBr5PFOJTr0SRcosRDQTAs0bWft1HJC6gOmqLAk0UI2n36XVPVdC7WXhjwJxqx0Oy; 20:aoYn5m6Ch+d/S2gH/bWaiWTqAldgWggiIHv9n6v0+LNnxyiM5DO9pj09uGYjyc2UHs1QeZe77sB/xyk9rX31Fdl+KfNx0HBxSMKBrAmT9KxxcknuRYPijkL7mcxNNcFQ0X7Dm4I1H4W3TXzUK/ct9H7RECvipqRZmtTVmOXLjJw= X-MS-Office365-Filtering-Correlation-Id: fcee02ee-68a8-416a-3db4-08d5b65bb9fe X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 09:52:20.3706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fcee02ee-68a8-416a-3db4-08d5b65bb9fe 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 The patch introduces shrinker::id number, which is used to enumerate memcg-aware shrinkers. The number start from 0, and the code tries to maintain it as small as possible. This will be used as to represent a memcg-aware shrinkers in memcg shrinkers map. Since all memcg-aware shrinkers are based on list_lru, which is per-memcg in case of !SLOB only, the new functionality will be under MEMCG && !SLOB ifdef (symlinked to CONFIG_MEMCG_SHRINKER). Signed-off-by: Kirill Tkhai --- fs/super.c | 3 ++ include/linux/shrinker.h | 4 +++ init/Kconfig | 5 ++++ mm/vmscan.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 71 insertions(+) diff --git a/fs/super.c b/fs/super.c index 122c402049a2..16c153d2f4f1 100644 --- a/fs/super.c +++ b/fs/super.c @@ -248,6 +248,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_time_gran = 1000000000; s->cleancache_poolid = CLEANCACHE_NO_POOL; +#ifdef CONFIG_MEMCG_SHRINKER + s->s_shrink.id = -1; +#endif s->s_shrink.seeks = DEFAULT_SEEKS; s->s_shrink.scan_objects = super_cache_scan; s->s_shrink.count_objects = super_cache_count; diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 6794490f25b2..d8f3fc833e6e 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -66,6 +66,10 @@ struct shrinker { /* These are for internal use */ struct list_head list; +#ifdef CONFIG_MEMCG_SHRINKER + /* ID in shrinker_idr */ + int id; +#endif /* objs pending delete, per node */ atomic_long_t *nr_deferred; }; diff --git a/init/Kconfig b/init/Kconfig index 1706d963766b..09e201c2ada9 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -680,6 +680,11 @@ config MEMCG_SWAP_ENABLED select this option (if, for some reason, they need to disable it then swapaccount=0 does the trick). +config MEMCG_SHRINKER + bool + depends on MEMCG && !SLOB + default y + config BLK_CGROUP bool "IO controller" depends on BLOCK diff --git a/mm/vmscan.c b/mm/vmscan.c index 10c8a38c5eef..d691beac1048 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -169,6 +169,47 @@ unsigned long vm_total_pages; static LIST_HEAD(shrinker_list); static DECLARE_RWSEM(shrinker_rwsem); +#ifdef CONFIG_MEMCG_SHRINKER +static DEFINE_IDR(shrinker_idr); + +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + int id, ret; + + down_write(&shrinker_rwsem); + ret = id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL); + if (ret < 0) + goto unlock; + shrinker->id = id; + ret = 0; +unlock: + up_write(&shrinker_rwsem); + return ret; +} + +static void del_memcg_shrinker(struct shrinker *shrinker) +{ + int id = shrinker->id; + + if (id < 0) + return; + + down_write(&shrinker_rwsem); + idr_remove(&shrinker_idr, id); + up_write(&shrinker_rwsem); + shrinker->id = -1; +} +#else /* CONFIG_MEMCG_SHRINKER */ +static int prealloc_memcg_shrinker(struct shrinker *shrinker) +{ + return 0; +} + +static void del_memcg_shrinker(struct shrinker *shrinker) +{ +} +#endif /* CONFIG_MEMCG_SHRINKER */ + #ifdef CONFIG_MEMCG static bool global_reclaim(struct scan_control *sc) { @@ -306,6 +347,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone int prealloc_shrinker(struct shrinker *shrinker) { size_t size = sizeof(*shrinker->nr_deferred); + int ret; if (shrinker->flags & SHRINKER_NUMA_AWARE) size *= nr_node_ids; @@ -313,11 +355,26 @@ int prealloc_shrinker(struct shrinker *shrinker) shrinker->nr_deferred = kzalloc(size, GFP_KERNEL); if (!shrinker->nr_deferred) return -ENOMEM; + + if (shrinker->flags & SHRINKER_MEMCG_AWARE) { + ret = prealloc_memcg_shrinker(shrinker); + if (ret) + goto free_deferred; + } + return 0; + +free_deferred: + kfree(shrinker->nr_deferred); + shrinker->nr_deferred = NULL; + return -ENOMEM; } void free_prealloced_shrinker(struct shrinker *shrinker) { + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + del_memcg_shrinker(shrinker); + kfree(shrinker->nr_deferred); shrinker->nr_deferred = NULL; } @@ -347,6 +404,8 @@ void unregister_shrinker(struct shrinker *shrinker) { if (!shrinker->nr_deferred) return; + if (shrinker->flags & SHRINKER_MEMCG_AWARE) + del_memcg_shrinker(shrinker); down_write(&shrinker_rwsem); list_del(&shrinker->list); up_write(&shrinker_rwsem);