From patchwork Fri May 18 08:42:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10408761 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 61A05602CB for ; Fri, 18 May 2018 08:42:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4ED8628707 for ; Fri, 18 May 2018 08:42:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A04928885; Fri, 18 May 2018 08:42:48 +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 6DE4728707 for ; Fri, 18 May 2018 08:42:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 741E36B05A8; Fri, 18 May 2018 04:42:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 71AB96B05A9; Fri, 18 May 2018 04:42:46 -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 5E0F26B05AA; Fri, 18 May 2018 04:42:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt0-f198.google.com (mail-qt0-f198.google.com [209.85.216.198]) by kanga.kvack.org (Postfix) with ESMTP id 2F11D6B05A8 for ; Fri, 18 May 2018 04:42:46 -0400 (EDT) Received: by mail-qt0-f198.google.com with SMTP id t3-v6so6165782qto.14 for ; Fri, 18 May 2018 01:42:46 -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=WAev2mRvESnMpiOMdA6nMo3DX576lizRTUAOQJk2Ssc=; b=nxMeOyQphj/zjtwbmD91j011H+ZQU3C4Z+srgrhgbwCmlz6AtMr4MGpSkEO63D0gZY hOk9Kam3IqXtyIz/MoBKP/epf7tURZ+IgnxCj5FPWIU5BUv0tMjjvIIUl9N+CaCFtvDa dQ0DEKg4mc2ZhL6Ewn+93KjP4mfj3r4FBmB4QIwislEdqiXGiScRkK25m7zyCuwoT0sR VCFTZV5hV7gYa1A2eI//k2NfXEioiBpEmx8YAjHycjSfIKOEHQ1IheI6XZlu8YWuWoGv Tl1vr/u/6QIe6kO4xgQLv5/nXqiEK+keNGvKgvHV6jAnaljJIIJ/gq7IfYsapw1oEjZz 1Ldg== X-Gm-Message-State: ALKqPweM5p9QDOb14bUC7v1dLsv6CyfZwFBnYiq2y5cLmMElC/QOwIYL yBBGW2pP0J+T+NvFQl0eL5fhQwPPMjiC7efePgx84Qew3UUMc8MQ1lffq8su3eUbORtw00JsMOe Xe2c0celVdSWoaDO6z6SmWn/XRZg5yrRPt24fspzTPcdSBiTDI6bkcY51iss2RfNfWw== X-Received: by 2002:ac8:4692:: with SMTP id g18-v6mr8673422qto.41.1526632965918; Fri, 18 May 2018 01:42:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoogynlWgIRK43aZd8KL8PNk/r9capg5WD4cjCuodE7J03jvvBWLSlwYFpGI0rDgZsLe65X X-Received: by 2002:ac8:4692:: with SMTP id g18-v6mr8673398qto.41.1526632965241; Fri, 18 May 2018 01:42:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526632965; cv=none; d=google.com; s=arc-20160816; b=cn6QkGJPi0MSkgjcgSltjQt86d+Sqn/Ob5g98ekiNEOmL5GGsEm//MLN3UNPXFdzob +yY1mWK2aDhlHRL9cD/kFjzll0BElY66IcOSTCE0m0XZiZV7gHlAAxMPgWmEDbdC7PXR WWjRYx5nF0+oNJ05Qjm7ff2s+LE1Ysp2eDSrBrwBDK69ZQYJJqh8vnjGoqsvAxEfRYxO ti8MbvqiR7Kle5xbaosTAJsDy2aFq0hHof5rIEr9trX46DoHULMsz82S/2GOn//oHuHn LajNKiz7jAr3rm6a9oggKNRwWrcCC+r0hXgtczGhCIsiSKETobixJxtGfWLAG7c8u9ZA qoYA== 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=WAev2mRvESnMpiOMdA6nMo3DX576lizRTUAOQJk2Ssc=; b=BjJ/U/4Pjuu44Fy1hPeQtauFDQrqail8hZE/SVbnDsl9IFfYLAZ7dQ+RQBEfxdcMMc rhZ2CCUHviqw+Md5OBvp4RQ7oAgBhGsshUm1k5apQDx9q9tISrpD0ojC/n0QyTT/hqqQ Hni5YO5776DI1ysjDbHjCwv1Bcp3Bke53JVe7w8gZ9lsJckf79Kv3p8wzfi4UKOcVeyD yC60mWCCEl4vYFIMLAX/aKeGGfPB2gpnnT2zbb54eLeR4Kf5+byXNlA+VLQ3Y0lJAEe7 wA5io77GO0hESrLywZDLm0cKVXvwdwZyYR0RcbIkochNVLKEfqlQKqFiZbUC/SyhL5za WYqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=afetB9wk; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.128 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-ve1eur01on0128.outbound.protection.outlook.com. [104.47.1.128]) by mx.google.com with ESMTPS id j10-v6si6100082qtk.213.2018.05.18.01.42.44 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 May 2018 01:42:45 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.128 as permitted sender) client-ip=104.47.1.128; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=afetB9wk; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.1.128 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=WAev2mRvESnMpiOMdA6nMo3DX576lizRTUAOQJk2Ssc=; b=afetB9wk1HCu2dRdmGKncSth1cbzr5LARrDjsE7daewQIb4c6w6czFKoNddTIrXzhsx/wyciRxGNK7srURAtocmk0qNpA/Wx7FJw0J6I5pE7hKuq3Ok+6ar8AOfAzxxlZBobmMmuO4hqg8Bz2oD/XK7GwOFmhjqjqajHD6cEj5g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by DB6PR0801MB1336.eurprd08.prod.outlook.com (2603:10a6:4:b::8) 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:42:39 +0000 Subject: [PATCH v6 05/17] mm: Assign memcg-aware shrinkers bitmap to memcg 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:42:37 +0300 Message-ID: <152663295709.5308.12103481076537943325.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: HE1PR05CA0160.eurprd05.prod.outlook.com (2603:10a6:7:28::47) To DB6PR0801MB1336.eurprd08.prod.outlook.com (2603:10a6:4:b::8) 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:DB6PR0801MB1336; X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1336; 3:7UVe0R9RLPQuRIOWh5fbAjhdgApwKkxUlV5IkeVaY6FSLXc4yp8U2pd5/iQdZRFtyhIV6wMDfEZqneqYBTHX6EsiYJG2Ka3xsFGEPJtmeVL17x2kbg8gCtXnQgW1Fnbpn9U67yvXlP6/gJ7V5XmjR9hbpISVKuOWv2/Dk/OwtiVdsxkImJW8m+JT/JAMh1XL+qlaRcHpKcIzYmvCvO420fPjKQHxPhfryOCNKAApg8U83OOJtQZLxPqca/Y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3lIw1cvdFryHFGmkyVKESHtygExov7pIxMadWlj9o239fRYxEcgi+MPMWAhYDhNkaUm/irqqTFBsTVCHCwp8eni8jL58Rk0Z/ys52; 4:udYzS9hNPWffRnRJY4XgzlZ1gEoNdR02sHC/qs4+Pv+qbGPhr1YePRVtRes+r3LsBv2WigBgJ40CIiYEDSuzdy8OI74bau3OwVXv4poiY15+VwqvpcN7AZ9jEWZv9EsUEbDTijAO8UtteCVSjqZip7+mO57ydT0PxOaplSVjLpiM6X4tZjy5yrOkKoC0siIpRPQ/2+T9j+iYdeGXrpoDznQsR7BCjPYNQqJ5C6ZUwy2WR01XQYHq0ZVNyIiPb9cDf8YZ0Hst1fLrwBSNmXAYLtm7HYnD/wxvNZEn9n1SGK1xEBAuo20ZQ2BuoOQMzuj1uNjHuDJh+uTQVd2HqxIZyrHRl7sNRaBzLI9m/+A1ug4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(209352067349851)(131327999870524); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(149027)(150027)(6041310)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:DB6PR0801MB1336; BCL:0; PCL:0; RULEID:; SRVR:DB6PR0801MB1336; X-Forefront-PRVS: 0676F530A9 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(366004)(39850400004)(39380400002)(346002)(376002)(189003)(199004)(316002)(25786009)(58126008)(6636002)(6116002)(39060400002)(3846002)(53936002)(9686003)(105586002)(106356001)(230700001)(97736004)(55016002)(50466002)(11346002)(23676004)(2486003)(52116002)(7696005)(7736002)(8676002)(81156014)(486006)(81166006)(305945005)(476003)(47776003)(8936002)(956004)(26005)(68736007)(16526019)(186003)(7416002)(76176011)(33896004)(86362001)(2906002)(386003)(59450400001)(478600001)(61506002)(446003)(103116003)(55236004)(6506007)(66066001)(5660300001)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:DB6PR0801MB1336; 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?MTtEQjZQUjA4MDFNQjEzMzY7MjM6Uld0Wm5zaDAwRDI3cjhlTmRrWFRDR0Zu?= =?utf-8?B?SnBtR3J2V3VzemdTdHVJOThXYlFQL2ZQRGk1aFpLeGQzR2lrSjh0eCtwaUgx?= =?utf-8?B?TXduR1orc1E2Um4yODlPekpyM09rREVzQ1Nza2czZEhHbFErZGV0OWdUbHdU?= =?utf-8?B?SzZvcFNWVnF5NUV4R0dCWWJyMUZramQ3bFg5WHFDcXByL3JnTFBORXZkTGpx?= =?utf-8?B?T01VWGZQanU2ZjZJQTd6ZzdrQW1lQWhGcUlXcmNYUmN6eVM2SXk5VlQ1OGx2?= =?utf-8?B?ZXNPN0JjeUc4TlR6NTgvMnN6ZGxRcFJMZUR3dFVLUUR5MkhrQ0twK2pMbW13?= =?utf-8?B?N0VzU214TUhwL2tYTU9XVWRXZ2VSWERGZVdOa0R6S3lRdDRSR1FrU1l5WFN2?= =?utf-8?B?UDZGQXFwRWhZVlJtcnV0Sno0akVBWlBFZlhFQW5qempNN0EybzQ2aVpkTDhi?= =?utf-8?B?UFRNbzIxVkozbnBOSEMwcTAyYWRhSHFjLzNXeFhqYTZZNlVYNmpwQm5UL0lX?= =?utf-8?B?OEl0RUdUWmNoQnZNOUUyWnRrYmdSdjYzcC9WK2R5N1RUSElzZjc1YU1nT2hV?= =?utf-8?B?NkhRWExic2VFOEY1MG1qdlV4aytkL0hhK2pZam1xcG50MUlSRGs4c2Ewc2pr?= =?utf-8?B?WjVMeVVMdjd0TW5ERFA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s8cqQyv1O/t6q5VOn6HMHijcm1J5pduAVZr33Gahv1dLUIgqT5Oz7S72MQ30Oi1xjKvrMbNwaEGSyZFdwced7GnY1l3Sf0ES8+zIsjsguPUoQGre0HNrfv4=; 24:L8cw4PrlhVK2tRfpbgIJ+QZP2gcb+JIQpC3SaCJ4fTdB77FRFUqX4lVnjnz/+BqK+TpVmSrXtIEqa6VYxCexkfEvij+huyd4I9T/cl6vG3E= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB6PR0801MB1336; 7:gPSjoNcWTJ5JyVodX+61UNURlrTCLyKlPYw0ixzmSr0abPK0IuXa0mjHjf0PmwyxXZwVZnpNjmJXtnJTBQfDiileWKJgOqKAIq9uatWEkVLqzih2FyYLSFdMCHjYJf2hclg/eLJxO/r9gLlX3U2ElXlas8ifMCBlydzCkuFK5qL0Yb0TeLn/1JyBb3GP3zf3o/4Fs1a2Thgwu92pDcvFJfBzzaejFsNaaEcqeHioW54Ekd3kg+P54vaK+qNvhdEj; 20:xIyqOMsn4GHnsRq48i3alwcGEenmhSim0nGRAaNXEq1jPB7axYCQsbHHvkcVYM/bhUmJ06C8YrRToRFyL+Jh4rXB+CGdd94lg3QUcUHzPT5kK1gsewBkDJahdbv5V4oj2L7fIYBtk80srTN4xw939WkM/XW6uUBCR1L+r07En3s= X-MS-Office365-Filtering-Correlation-Id: 4bc14661-dadf-4f49-f111-08d5bc9b51c0 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2018 08:42:39.9545 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4bc14661-dadf-4f49-f111-08d5bc9b51c0 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1336 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 Imagine a big node with many cpus, memory cgroups and containers. Let we have 200 containers, every container has 10 mounts, and 10 cgroups. All container tasks don't touch foreign containers mounts. If there is intensive pages write, and global reclaim happens, a writing task has to iterate over all memcgs to shrink slab, before it's able to go to shrink_page_list(). Iteration over all the memcg slabs is very expensive: the task has to visit 200 * 10 = 2000 shrinkers for every memcg, and since there are 2000 memcgs, the total calls are 2000 * 2000 = 4000000. So, the shrinker makes 4 million do_shrink_slab() calls just to try to isolate SWAP_CLUSTER_MAX pages in one of the actively writing memcg via shrink_page_list(). I've observed a node spending almost 100% in kernel, making useless iteration over already shrinked slab. This patch adds bitmap of memcg-aware shrinkers to memcg. The size of the bitmap depends on bitmap_nr_ids, and during memcg life it's maintained to be enough to fit bitmap_nr_ids shrinkers. Every bit in the map is related to corresponding shrinker id. Next patches will maintain set bit only for really charged memcg. This will allow shrink_slab() to increase its performance in significant way. See the last patch for the numbers. Signed-off-by: Kirill Tkhai --- include/linux/memcontrol.h | 14 +++++ mm/memcontrol.c | 120 ++++++++++++++++++++++++++++++++++++++++++++ mm/vmscan.c | 10 ++++ 3 files changed, 144 insertions(+) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 996469bc2b82..e51c6e953d7a 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -112,6 +112,15 @@ struct lruvec_stat { long count[NR_VM_NODE_STAT_ITEMS]; }; +/* + * Bitmap of shrinker::id corresponding to memcg-aware shrinkers, + * which have elements charged to this memcg. + */ +struct memcg_shrinker_map { + struct rcu_head rcu; + unsigned long map[0]; +}; + /* * per-zone information in memory controller. */ @@ -125,6 +134,9 @@ struct mem_cgroup_per_node { struct mem_cgroup_reclaim_iter iter[DEF_PRIORITY + 1]; +#ifdef CONFIG_MEMCG_KMEM + struct memcg_shrinker_map __rcu *shrinker_map; +#endif struct rb_node tree_node; /* RB tree node */ unsigned long usage_in_excess;/* Set to the value by which */ /* the soft limit is exceeded*/ @@ -1261,6 +1273,8 @@ static inline int memcg_cache_id(struct mem_cgroup *memcg) return memcg ? memcg->kmemcg_id : -1; } +extern int memcg_expand_shrinker_maps(int new_id); + #else #define for_each_memcg_cache_index(_idx) \ for (; NULL; ) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 023a1e9c900e..317a72137b95 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -320,6 +320,120 @@ EXPORT_SYMBOL(memcg_kmem_enabled_key); struct workqueue_struct *memcg_kmem_cache_wq; +static int memcg_shrinker_map_size; +static DEFINE_MUTEX(memcg_shrinker_map_mutex); + +static void memcg_free_shrinker_map_rcu(struct rcu_head *head) +{ + kvfree(container_of(head, struct memcg_shrinker_map, rcu)); +} + +static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg, + int size, int old_size) +{ + struct memcg_shrinker_map *new, *old; + int nid; + + lockdep_assert_held(&memcg_shrinker_map_mutex); + + for_each_node(nid) { + old = rcu_dereference_protected( + memcg->nodeinfo[nid]->shrinker_map, true); + /* Not yet online memcg */ + if (!old) + return 0; + + new = kvmalloc(sizeof(*new) + size, GFP_KERNEL); + if (!new) + return -ENOMEM; + + /* Set all old bits, clear all new bits */ + memset(new->map, (int)0xff, old_size); + memset((void *)new->map + old_size, 0, size - old_size); + + rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, new); + if (old) + call_rcu(&old->rcu, memcg_free_shrinker_map_rcu); + } + + return 0; +} + +static void memcg_free_shrinker_maps(struct mem_cgroup *memcg) +{ + struct mem_cgroup_per_node *pn; + struct memcg_shrinker_map *map; + int nid; + + if (mem_cgroup_is_root(memcg)) + return; + + for_each_node(nid) { + pn = mem_cgroup_nodeinfo(memcg, nid); + map = rcu_dereference_protected(pn->shrinker_map, true); + if (map) + kvfree(map); + rcu_assign_pointer(pn->shrinker_map, NULL); + } +} + +static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) +{ + struct memcg_shrinker_map *map; + int nid, size, ret = 0; + + if (mem_cgroup_is_root(memcg)) + return 0; + + mutex_lock(&memcg_shrinker_map_mutex); + size = memcg_shrinker_map_size; + for_each_node(nid) { + map = kvzalloc(sizeof(*map) + size, GFP_KERNEL); + if (!map) { + memcg_free_shrinker_maps(memcg); + ret = -ENOMEM; + break; + } + rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, map); + } + mutex_unlock(&memcg_shrinker_map_mutex); + + return ret; +} + +int memcg_expand_shrinker_maps(int nr) +{ + int size, old_size, ret = 0; + struct mem_cgroup *memcg; + + size = DIV_ROUND_UP(nr, BITS_PER_BYTE); + old_size = memcg_shrinker_map_size; + if (size <= old_size) + return 0; + + mutex_lock(&memcg_shrinker_map_mutex); + if (!root_mem_cgroup) + goto unlock; + + for_each_mem_cgroup(memcg) { + if (mem_cgroup_is_root(memcg)) + continue; + ret = memcg_expand_one_shrinker_map(memcg, size, old_size); + if (ret) + goto unlock; + } +unlock: + if (!ret) + memcg_shrinker_map_size = size; + mutex_unlock(&memcg_shrinker_map_mutex); + return ret; +} +#else /* CONFIG_MEMCG_KMEM */ +static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) +{ + return 0; +} +static void memcg_free_shrinker_maps(struct mem_cgroup *memcg) { } #endif /* CONFIG_MEMCG_KMEM */ /** @@ -4482,6 +4596,11 @@ static int mem_cgroup_css_online(struct cgroup_subsys_state *css) { struct mem_cgroup *memcg = mem_cgroup_from_css(css); + if (memcg_alloc_shrinker_maps(memcg)) { + mem_cgroup_id_remove(memcg); + return -ENOMEM; + } + /* Online state pins memcg ID, memcg ID pins CSS */ atomic_set(&memcg->id.ref, 1); css_get(css); @@ -4534,6 +4653,7 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css) vmpressure_cleanup(&memcg->vmpressure); cancel_work_sync(&memcg->high_work); mem_cgroup_remove_from_trees(memcg); + memcg_free_shrinker_maps(memcg); memcg_free_kmem(memcg); mem_cgroup_free(memcg); } diff --git a/mm/vmscan.c b/mm/vmscan.c index 3de12a9bdf85..f09ea20d7270 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -171,6 +171,7 @@ static DECLARE_RWSEM(shrinker_rwsem); #ifdef CONFIG_MEMCG_KMEM static DEFINE_IDR(shrinker_idr); +static int memcg_shrinker_nr_max; static int prealloc_memcg_shrinker(struct shrinker *shrinker) { @@ -181,6 +182,15 @@ static int prealloc_memcg_shrinker(struct shrinker *shrinker) ret = id = idr_alloc(&shrinker_idr, shrinker, 0, 0, GFP_KERNEL); if (ret < 0) goto unlock; + + if (id >= memcg_shrinker_nr_max) { + if (memcg_expand_shrinker_maps(id + 1)) { + idr_remove(&shrinker_idr, id); + goto unlock; + } + memcg_shrinker_nr_max = id + 1; + } + shrinker->id = id; ret = 0; unlock: