From patchwork Mon Jul 9 08:39:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10513977 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 BEF606032A for ; Mon, 9 Jul 2018 08:39:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6BCA28A5A for ; Mon, 9 Jul 2018 08:39:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A4DD28A5E; Mon, 9 Jul 2018 08:39:47 +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 EBA3928A5A for ; Mon, 9 Jul 2018 08:39:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA6016B029F; Mon, 9 Jul 2018 04:39:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C55676B02A0; Mon, 9 Jul 2018 04:39:45 -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 AD03B6B02A1; Mon, 9 Jul 2018 04:39:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id 66D466B029F for ; Mon, 9 Jul 2018 04:39:45 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id s3-v6so9658147plp.21 for ; Mon, 09 Jul 2018 01:39:45 -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=CICRSzF2GCe9mPZHynBVFS1tpCEK4vd85KsEr3JL4ME=; b=nrJYjOr0h4f+tdimtMjkIqz+7lzHDTpCktUEwKAiUULXCMbWQCa/aJ073vV/qo0yEv lyc8bgw/0y+YDt9k7r0X1oL6FJp2tz/AB3J8uUetIuNh8kiFHzM//WpnoIURF/eSXecf AvwfcpggOXRjTstpmxfjM7hTG8Au53YRZw2t5U6w8r5xRRBg1tnf3ujfqzAYefB3SqZm /g/9koc+pmBEEyroEmT9hLFOW5n1oQAkhg1v3+UdfcAM7zjbVar73IR0kA1l84bK61vr 6QXxuYwBxxOQ8KW9vhdF2PflkDL8+hcMN6DLXmEh/QjXruVDmKjhm7hsIYs89AF4OtgF 5yng== X-Gm-Message-State: APt69E27/1ULR5QxTL7CcN2aLJseo97ixqh6+7lb7wGZYTXd4Dr1B9B8 4zxp2UZKVYl0HXg+eILF2dawpuVVbJ3eKOsUKmeIdHUsEOrGnWJasShU6ESMjyAc9GCPMXHU2gd r+MS9zA5YiCgIAQjqltHy/Raal/FNDi0ys0FW1HrmJMpekfqRw4J1gkhpVqzQ4mum2Q== X-Received: by 2002:a62:f50b:: with SMTP id n11-v6mr20296210pfh.120.1531125585095; Mon, 09 Jul 2018 01:39:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcYsi/cX+EnaKMXcUJSwzEP5WJGBRti+K6+PCOUSxJL6X2/TBKgZR+M4lRQGYJKhaclPIy4 X-Received: by 2002:a62:f50b:: with SMTP id n11-v6mr20296148pfh.120.1531125584051; Mon, 09 Jul 2018 01:39:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531125584; cv=none; d=google.com; s=arc-20160816; b=iZoGNw1HS0UZmH7Gmi5GQUQS7p31aDTyfz/tq6ujOLubiC2/2JbqxtyodOPoKmYBxN Ni0QSqXVQ9lIsM/ohmFzLQGrDNuuQ0/65dtPwBdDkHMpkCsweZ8eFhhE8Bi/ch/fn6zV 3L9SLWb12o33S6YHXY3FDr9YXd244xdpnMsu0Vgg1hUpJrdmVmSiOlvCJ9u+MGQx/AZq 9s9bJ5NRsgkAsZb7eoxSITs1CBreGxAq0OYjE8b2w2nuir8Uc0yp3oE+8SZGXX9xUEMT 99DABON8l6Dk7KKC2U9xBx5g069HOFaPHo7NNBu5p23yUYe1Snd/mt8b01K7AAwLhqWH vG4w== 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=CICRSzF2GCe9mPZHynBVFS1tpCEK4vd85KsEr3JL4ME=; b=gefpjs+dw09uEajJFz5gQcUq0xZ/+r7cOkZeysYMTm1od3uGP2XZtsytHu9ieUQY7r EUfN4yNea9dpLb3JoUt0vJ5EFfsQ0ucGSJj/ku/7P2T0bQp/8nbJAEs/g4urwt6m8A/H hMvIVLvYha3F8qby38YjIj7UGeqinkDPi1Gx2xYgrgG2WFqQdE/cRa8sZi7tfo/qXUnm 5AadCQjMhEqaSYJcnvjAbfcV00BlrVoPZpHAddXLHT9pRvXmZgkchyIB5lnGxse5MQg+ abYhyBQaEZIjTc6K6lTfIYGM6uEvHCpcbcQHC/VDst08lVzS0Y9lr+6phaKbxhQ3DEtX 802A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Ct7MtOHI; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.104 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-eopbgr20104.outbound.protection.outlook.com. [40.107.2.104]) by mx.google.com with ESMTPS id 34-v6si13663108pgs.243.2018.07.09.01.39.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Jul 2018 01:39:44 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.104 as permitted sender) client-ip=40.107.2.104; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Ct7MtOHI; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.2.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=CICRSzF2GCe9mPZHynBVFS1tpCEK4vd85KsEr3JL4ME=; b=Ct7MtOHIibwm1A2RDP7PQYBfo4cNJtdi0dHnkkk5ruZhQWYoZqW8GjxbCDAzqHRzNePBBblo8B2rZMiYTwdSq8ee/emx8PpMMalpUwtSSp1fzGPAvHvQBO0uE4VNMxKtaDnVD9Bq6BQEji8FpcI9C7mypNyNnhTlgDs32b+BEAo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (185.231.240.5) by HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.20; Mon, 9 Jul 2018 08:39:37 +0000 Subject: [PATCH v9 13/17] mm: Set bit in memcg shrinker bitmap on first list_lru item apearance 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:35 +0300 Message-ID: <153112557572.4097.17315791419810749985.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: AM5PR0701CA0015.eurprd07.prod.outlook.com (2603:10a6:203:51::25) To HE1PR0801MB1338.eurprd08.prod.outlook.com (2603:10a6:3:39::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b5ec5293-31a2-406d-3d65-08d5e577829c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1338; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1338; 3:HTgXxt4Fwc2sZWJ000hFOKFLOi3dA/SlyaT+z3Cik2bL1X/5hwqk3C07ZVX/Peo1Ej0Avj/v3wPb50o1Bt9PGToYdZByQTQxwbL4DzM90gohQ8x+Yewgs6My2lmysTcvAvN/kYbdpxcj3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18SIAZDXSq8c0enJjJ9+3KeZHctVGCUE6xfyNCYr+gg4hw1DhV/37GU8CxLfL2fT6J+x77vtW30jBoP2dViXCzvo/wCdtEHTPy8jCZdNMFR46XO381lP6oPzMM9DDpoO46xH6NsvYk3tjopcFPDHUD4QCZFyn4Bl8/SQfWsfdpgwXuE6RdfG9mEIqudJfIAe8OHKzYKcRqB/+mNKYEr/ZaxmJ1Lc1wt; 4:e4/G8IA2JM+TdfTXa+0ztidsI3NMBgk2fR9v6EmjPiSu3nitaNxmzHlhpQY2N10/hZ1uX7ff8dzuJIubC6YdOoraEZAc+zP2g1JQQIPxouChirtpQEviZc08TA14xzosLTdLe1Cb9fmilw9GoPJneeyA16Qa6EINLOfaCSz5htjIVO0iH9KeLSvDEoBMVFc/1NWRdi/iPkSSmnHbQ3R/dDbna+uwVm4Epvya0f1G3SbOUAYQRjl1XhD8+EKqB1GFW792qi7lD4JWnbxzsmzl0ixcNonfh3Ri8RjuEBzrMlqhxpU39OHuzphwt6911yTXCsuWczKdrBTWF28rQJl9ALEdQDYsmbYqJM/RMxqTOs3//cLr8094lG2YhIF1EL4d 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)(5005006)(8121501046)(93006095)(93001095)(3002001)(10201501046)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:HE1PR0801MB1338; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1338; X-Forefront-PRVS: 07283408BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(136003)(376002)(346002)(366004)(39850400004)(199004)(189003)(23676004)(103116003)(478600001)(26005)(9686003)(76176011)(50466002)(106356001)(3846002)(105586002)(6116002)(14444005)(6506007)(66066001)(53936002)(186003)(33896004)(55016002)(47776003)(68736007)(7696005)(2486003)(52116002)(316002)(39060400002)(61506002)(386003)(230700001)(97736004)(16526019)(8676002)(7416002)(5660300001)(2906002)(81166006)(86362001)(575784001)(8936002)(81156014)(305945005)(7736002)(486006)(58126008)(11346002)(956004)(446003)(25786009)(476003)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1PR0801MB1338; 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?MTtIRTFQUjA4MDFNQjEzMzg7MjM6NkRYYUowWTByU1h0bkpCcm41Mk42UHFj?= =?utf-8?B?bklGWDlKY1lSZlpXRWJNYjZxcDA0dlhEaEd4dlNKRFI1MzR6RmwvWFVkOTdp?= =?utf-8?B?SGtxd3pDRWQwWTdvTStiN3h1QkI1Y24vV3lZL1NHdEFZb1FMTW9obW1sY01a?= =?utf-8?B?c1Y0MDc3eUZCU2JJeS9hclI3R3BySG5pRXV5L0U3UHd0V1gzMUY0VGl1ckdr?= =?utf-8?B?VnlhZlFUbThsamtNaUJ0MnFNUkQ3dWd6c0xrL1lKanJiZlM3clFNZisySVQv?= =?utf-8?B?aFdabGpKM29yOWlFN2hTNFIrWkVJS1lpL3BQMU1tVWdLSW5RSjM0UkY2T2RE?= =?utf-8?B?dFJYdDNHb2h0MTloVXM3SU4vM21pWFliTzFkZXhvS3R2ODBWaUl0KzdrWGpT?= =?utf-8?B?WWgyZUpiVEFuMWRWaU91UC9iK1dhVC9BZVRvR21NZ09OUnExd2xBK0U4U2dt?= =?utf-8?B?bmNTMnVSejBoVVdWUXFFek9xdThyWTBDd0UrNHR2YTc1S2ZWZW1xcXhjQVFD?= =?utf-8?B?TVBsYklFWmdxLzhvbkgxaFVMcUlPS1ZPWThaVjZPcD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wgl14KTbY7TQe/GlWxEOcE5siReiZ4gWhy+Pi9b13eH52kbCjqsbLDBUk4/xtTCUjzcKIdN2RshVT/pHMbKSwMickQcsgRuxlnrmmOaSYRTnMNHzpakb9h/DYFFZlOja0G4LWN6VqxhfiVCV8axnhtOBLj3G7Fq79m0rEw0vqbjvcWWIeA==; 5:uxNel3WYqSMzdjTMi49ffoKAyvd613X8iGPquARAtzNv5DVeDNaO6Qxd8FfhwHxHydGz/FwZ59XYfl76KmarxCL+gSd5HIJ24Qh0vRPHxK/SwSe/gDkYCxO9Io8paydI/rmQzfGpA+yh6wosivhqL0XLaaci815DryQp+txSewM=; 24:LH/x1Wt0h0rqJzy4Of995j3Xn47fjwU8oNcRYj9VUct6V6Li3EQcwHjCiyU7CtBMncEan333txG5Su9xSprgZw6D8rupGwnJS0ZlhceEPRY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0801MB1338; 7:9yqkxzie561KIcnqzl1RRStX7UTZYQGe8r3zb81GFSQ+ZLWro1K6/1Rkx4WMhhFRiDB2ZpXT6OKrZnk7k0zfTUrmq9LRUqvmOqjbJYVQy6ZQBL7sAxv4XNbP3ZUU3vi7AIStXsyv0nvix7giUqgC5OIWLQ+GnMqMRQS1PcDJ0oorn9x09uv51FTbGeVOJSqxzbNsqvGRc1NUS6fN7hivxmL9o1mU6fFRb9YFy9lwATVjmpueeHBEf4BNZOmHI2gN; 20:yX8DjnoGzWVwnYxALjgVKqV1fP8h2kTdOCE15VQqkU5KuOtBZ5kqtx85iA0mj5JmZ4wDCROKgOVDQ+8iogC3XpcofMBdvjlDeo41VXyKCwZCn74W9DQAfevFJJy2bQmcTMYJYbsCkskovUb1aPi2b23FLIMeVtIy+YpTeFZS+Xg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2018 08:39:37.5981 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b5ec5293-31a2-406d-3d65-08d5e577829c X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1338 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 Introduce set_shrinker_bit() function to set shrinker-related bit in memcg shrinker bitmap, and set the bit after the first item is added and in case of reparenting destroyed memcg's items. This will allow next patch to make shrinkers be called only, in case of they have charged objects at the moment, and to improve shrink_slab() performance. Signed-off-by: Kirill Tkhai Acked-by: Vladimir Davydov Tested-by: Shakeel Butt --- include/linux/memcontrol.h | 4 ++++ mm/list_lru.c | 22 ++++++++++++++++++++-- mm/memcontrol.c | 13 +++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index e931cb4a7bb9..1da0c3c57a83 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1249,6 +1249,8 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) extern int memcg_expand_shrinker_maps(int new_id); +extern void memcg_set_shrinker_bit(struct mem_cgroup *memcg, + int nid, int shrinker_id); #else #define for_each_memcg_cache_index(_idx) \ for (; NULL; ) @@ -1271,6 +1273,8 @@ static inline void memcg_put_cache_ids(void) { } +static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, + int nid, int shrinker_id) { } #endif /* CONFIG_MEMCG_KMEM */ #endif /* _LINUX_MEMCONTROL_H */ diff --git a/mm/list_lru.c b/mm/list_lru.c index c6131925ec76..c9bdde9c03d1 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -30,6 +30,11 @@ static void list_lru_unregister(struct list_lru *lru) mutex_unlock(&list_lrus_mutex); } +static int lru_shrinker_id(struct list_lru *lru) +{ + return lru->shrinker_id; +} + static inline bool list_lru_memcg_aware(struct list_lru *lru) { /* @@ -93,6 +98,11 @@ static void list_lru_unregister(struct list_lru *lru) { } +static int lru_shrinker_id(struct list_lru *lru) +{ + return -1; +} + static inline bool list_lru_memcg_aware(struct list_lru *lru) { return false; @@ -118,13 +128,17 @@ bool list_lru_add(struct list_lru *lru, struct list_head *item) { int nid = page_to_nid(virt_to_page(item)); struct list_lru_node *nlru = &lru->node[nid]; + struct mem_cgroup *memcg; struct list_lru_one *l; spin_lock(&nlru->lock); if (list_empty(item)) { - l = list_lru_from_kmem(nlru, item, NULL); + l = list_lru_from_kmem(nlru, item, &memcg); list_add_tail(item, &l->list); - l->nr_items++; + /* Set shrinker bit if the first element was added */ + if (!l->nr_items++) + memcg_set_shrinker_bit(memcg, nid, + lru_shrinker_id(lru)); nlru->nr_items++; spin_unlock(&nlru->lock); return true; @@ -507,6 +521,7 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid, struct list_lru_node *nlru = &lru->node[nid]; int dst_idx = dst_memcg->kmemcg_id; struct list_lru_one *src, *dst; + bool set; /* * Since list_lru_{add,del} may be called under an IRQ-safe lock, @@ -518,7 +533,10 @@ static void memcg_drain_list_lru_node(struct list_lru *lru, int nid, dst = list_lru_from_memcg_idx(nlru, dst_idx); list_splice_init(&src->list, &dst->list); + set = (!dst->nr_items && src->nr_items); dst->nr_items += src->nr_items; + if (set) + memcg_set_shrinker_bit(dst_memcg, nid, lru_shrinker_id(lru)); src->nr_items = 0; spin_unlock_irq(&nlru->lock); diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 5a39fada3562..70881f04775d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -422,6 +422,19 @@ int memcg_expand_shrinker_maps(int new_id) mutex_unlock(&memcg_shrinker_map_mutex); return ret; } + +void memcg_set_shrinker_bit(struct mem_cgroup *memcg, int nid, int shrinker_id) +{ + if (shrinker_id >= 0 && memcg && !mem_cgroup_is_root(memcg)) { + struct memcg_shrinker_map *map; + + rcu_read_lock(); + map = rcu_dereference(memcg->nodeinfo[nid]->shrinker_map); + set_bit(shrinker_id, map->map); + rcu_read_unlock(); + } +} + #else /* CONFIG_MEMCG_KMEM */ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) {