Received: by 10.192.165.156 with SMTP id m28csp213192imm; Tue, 17 Apr 2018 08:57:02 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ryxq9vrkwDbkecMq/H6J/QJ59ja5Z2iIgxoJrHqV5OQ8LhA/j4xa22vFESjfo3luW34GH X-Received: by 2002:a17:902:9a0c:: with SMTP id v12-v6mr2508259plp.162.1523980622385; Tue, 17 Apr 2018 08:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523980622; cv=none; d=google.com; s=arc-20160816; b=n2tlmgEBxqNOdK7ACVtK6Ac2LYgP/EZVoE9xUNfXQ/NyDRNV3NYUi2HfkO2kBo0k4J y9qcZQuua7MM+n4DYD6GKbbFdd7xIM7VQVMvmy2AbbUWURY7h5jCm4htHV39/tScvU2D cRL93v2H6RfHLZKPCcjtxcg6UFplcQbSOteVCbOuwt7O76kgT/Wp+HW7AmzbxNXMZabL xyaXlBH/zxvSc6/BBxOhLtum+iBkFZtPKmqaC0bRPN6spbkItCNnRfGq3qQcu92IW8Y5 +PyD57MUm1MJys52aV45K7UfM3zn+BOZuGK46tYL5V7chG68x40iS9i+yqdHoTu42fbk U+8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=jugilo5jN6YuiAkkqCvIrlMx1hzlEBMn1FYEw9YufUw=; b=gqYeEGhK9isdwU/dGXVN61zC2/AE9AtrZD6UtiHGtwvmpTGpJXUvDJ2+HJt8bE8XBU l4MXx8a5duR0gBg6eXeFxXfeHriQVdf9FNZbidttgRjpKfFnZfXOmM2JkT/xT7gD7UFn soV+ZwT0EziWLHENu03ZTykg34Etfp+BHQpj9MM+y4xK8n+8b1NvXB5bPnZ6GX/iyCh7 G7Rilde3hi6yiWIxXjhljUCEoco3QhdCMKNktf/k4m+pwqYoHGUu28JXVfrBpl4n/DbG XhITUkpLTr6cG4lzDXkg+8zbcLPXcGUkXlIpTiSrplH+8Y3fI7HdfkLi0ky53QqhSj2E c/sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=EopDPAjx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t2si12010461pgb.338.2018.04.17.08.56.48; Tue, 17 Apr 2018 08:57:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=EopDPAjx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753220AbeDQPyF (ORCPT + 99 others); Tue, 17 Apr 2018 11:54:05 -0400 Received: from mail-db5eur01on0116.outbound.protection.outlook.com ([104.47.2.116]:45412 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751187AbeDQPyA (ORCPT ); Tue, 17 Apr 2018 11:54:00 -0400 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=jugilo5jN6YuiAkkqCvIrlMx1hzlEBMn1FYEw9YufUw=; b=EopDPAjxPdhrETUcG5fB9XmZP+rwMN2wbSnONFisIHRfnKXZPChJzXRXFLm1HC6xFN00SVY8NCHV5rXATHF5lrQsAOEpP5961m0/z4JSh8KGnbneQEwVfu/N5FBSlQ2m8ss55s4NYp4OjActSelW87p6W/sRjQw64luFUQ9LPYY= Received: from localhost.localdomain (195.214.232.6) by HE1PR0801MB1340.eurprd08.prod.outlook.com (2603:10a6:3:3a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.675.14; Tue, 17 Apr 2018 15:53:56 +0000 Subject: [PATCH v2 05/12] fs: Propagate shrinker::id to list_lru 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, hillf.zj@alibaba-inc.com, 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: Tue, 17 Apr 2018 21:53:47 +0300 Message-ID: <152399122780.3456.1111065927024895559.stgit@localhost.localdomain> In-Reply-To: <152397794111.3456.1281420602140818725.stgit@localhost.localdomain> References: <152397794111.3456.1281420602140818725.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0502CA0001.eurprd05.prod.outlook.com (2603:10a6:3:e3::11) To HE1PR0801MB1340.eurprd08.prod.outlook.com (2603:10a6:3:3a::8) 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:HE1PR0801MB1340; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;3:9qqPS4qTYN5W+gs6l+Sx3XnOZzC1IurkL51BOLxscbhtvabY2wndWtUqJsmIvyGzrWGRJ2cwMucKqUC/jG/a/MYboTDHHLiADDF7I8LYRpUCFbPqhEKy41ZB99gSnkv72Pvl/y9GrcuNMS4SsU1a7Nll1uo2FZ+TsxI1GaOfA8iMFN4uye1RAfT39YaRx4cf/W0BHaZHDALHbz7BCqlYHS/8uvy9EXI3I75w5Q3Iohm3XdelI7WPA7gpMvxwlPUz;25:jCoN85JA7+Kqxkiadz41Jibp2dcYCVYOqHJAd2F4pztgjvKkdQKpZd0cf5KifDz3ljqraYBsxUzMp7CqW6kfstT1JIu/KfVIdj296ucSDbpBgmmALvFvTznutgoYsdSxX8rsju8BurGr8aaWNwlOP+0/yyJDyrPZciR2HHIzIphglI0YD8QOklyB/sb9htWdll2qv1RMXBpSpdpWeZUlNX8RxlQbgzkEENaM6Q0NZA2pv6/w63rOBWS2vg5hlIhwaGRNdYCzmpmrJZvDWkVZXTZlRj14svswj5owFPGmqyNsCd6zuUjRH6DoZZTtLepph02aTos/YyWtLXXZLIonqw==;31:Hq/2VGiBKhOavdDwEzQXqp8AaDjBEEjJPSTzyOYTx5LiiL+kgBFmDxS3k/GBj7i7oNJjiBsX5kpuAZpRcxzGZYVRuP3u69neCnwadPYnK/xMdayZDFy1Pa5kT0UlTuvWEMbW1DD56LftsjGScgl+GN4hTA5gy+MDFl8MZ4hSQ97eCmpjDkfsL2cHgIeuea7JKuc53lpAL3BbsSsrCAwiiEmkC2HU8QMdiikVbFAnZ2g= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1340: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;20:Q/q9BGne/nafDsEMv9J/gtu3flWrD5wjwKn1MRZefsZ5WlNPOSujiAANKkPZC5YdzLH361/NdwbwBQJWdbHVQn7R5zmRlOEUjcYx0D6gHtWqJF9H+J986j0zWTqLfJXWPITkLclUIoSv7de+DPo8CXOwge+q5l8nU7a4wEvAAGJl1rpVNB/xm/CvCmf5DLA5a4z4a3CGm/h31zCP5zlHdM7kIJC3SJ8w5mCtpTzcPsnBbwQhOLn5cFq13WnJui/4l9bYVvTx4PoySH7xa2fpsHZZPDZilyvpVTIZr2Z7mXASknVL8Skbp1yhj/LwLmhVivyGD75GbV/Zcvkb+waCfC8CBVlslU9eif6WqXnwuCipCcBTSVGmWudJ8H62ZqM3hjtR9nLuFXjBXSmhHJwZmyW3Vi+5o+jgq8RZvifuEwZcPFqG4gB9ukjo2xZAdeR8cjDl40fnSKPuxcPlkSnOpLwPcLd0VAdCr43g85/kXyAW3FOKQoJ155HMI+kMpXH2;4:aR4wsvG83tyhxhkgL//XV9FFc1BB/O9MSOAo5SSFGzDw309+l2xVlVq7QtG7NSABfh3Zh4Yq/MjRZr2ResedSFJlbRh4h98bVB0ihxQDY6HhhbM3dy4uowenoGEvYiPEBOyYeJg09/za3oB9wDRUHfLU/R8r16+Sfl3+LrhymT/hIRJ3e+y5Rn2nEsysECx5kEkzeU17+5fY0/nlXbE+fTqAtnz5NGUjqhNdsJPUIxaOat9jUqAOHmYRTsu1IVr9fPi/YKNLX/lXmpgVoxayEA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3231232)(944501359)(52105095)(10201501046)(3002001)(93006095)(93001095)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:HE1PR0801MB1340;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1340; X-Forefront-PRVS: 0645BEB7AA X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(366004)(39850400004)(376002)(39380400002)(346002)(396003)(199004)(189003)(6116002)(66066001)(386003)(59450400001)(68736007)(7736002)(16526019)(478600001)(486006)(58126008)(7416002)(956004)(53936002)(305945005)(86362001)(55236004)(316002)(47776003)(476003)(97736004)(55016002)(33896004)(11346002)(8936002)(103116003)(5660300001)(76176011)(52116002)(7696005)(81166006)(105586002)(81156014)(8676002)(61506002)(446003)(23676004)(2486003)(3846002)(9686003)(230700001)(39060400002)(6636002)(25786009)(6666003)(186003)(26005)(50466002)(2906002)(6506007)(106356001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1340;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?MTtIRTFQUjA4MDFNQjEzNDA7MjM6UUt2c2w3MHNQL2JmNXNqNzgxUWZNWk9L?= =?utf-8?B?Y3cvTmNuOVNOWkJqVkpoUjluMjZ1SGtKR2sycVp0N2NHOWdkWVk3Tkk5UDZH?= =?utf-8?B?MllKN3pkY2pFKzRFaHJ5T3EvRUpkL3o3ay8za1NTeVJneGxtTlBPdmpBb2kv?= =?utf-8?B?M1Q1c3hkM093QWZSQWRYSmZnZjc5Q3ZEMFJ4VEdOL21BR05UdnBuVkxWWWNV?= =?utf-8?B?ZTF4SUFsRXIyT0ZnQjlFMHFNdE1wbFppYlYrV000QVdkYmlGTFZoWFNiRHJt?= =?utf-8?B?UXRFcXZzeXV5TXRuY3gvaEJZM0N2WEtIR0tVdW4yOGJHNmpKeDJPWmtjWUFw?= =?utf-8?B?aCtSbFRRL1lvZ0ZiM0RKUXhwTjdkVWFCakN1T2ZvS21NMGRORDhiMnliMW45?= =?utf-8?B?d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tTjZX8esJ6HVt5C/Y= X-MS-Office365-Filtering-Correlation-Id: 58c9b72f-56a7-4b49-0f13-08d5a47b6df2 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2018 15:53:56.6868 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58c9b72f-56a7-4b49-0f13-08d5a47b6df2 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1340 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch adds list_lru::shrinker_id field, and populates it by registered shrinker id. This will be used to set correct bit in memcg shrinkers map by lru code in next patches, after there appeared the first related to memcg element in list_lru. Signed-off-by: Kirill Tkhai --- fs/super.c | 4 +++- include/linux/list_lru.h | 1 + include/linux/shrinker.h | 8 +++++++- mm/list_lru.c | 6 ++++++ mm/vmscan.c | 15 ++++++++++----- mm/workingset.c | 3 ++- 6 files changed, 29 insertions(+), 8 deletions(-) diff --git a/fs/super.c b/fs/super.c index 5fa9a8d8d865..9bc5698c8c3c 100644 --- a/fs/super.c +++ b/fs/super.c @@ -518,7 +518,9 @@ struct super_block *sget_userns(struct file_system_type *type, hlist_add_head(&s->s_instances, &type->fs_supers); spin_unlock(&sb_lock); get_filesystem(type); - err = register_shrinker(&s->s_shrink); + err = register_shrinker_args(&s->s_shrink, 2, + &s->s_dentry_lru.shrinker_id, + &s->s_inode_lru.shrinker_id); if (err) { deactivate_locked_super(s); s = ERR_PTR(err); diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h index 96def9d15b1b..f5b6bb7a8670 100644 --- a/include/linux/list_lru.h +++ b/include/linux/list_lru.h @@ -53,6 +53,7 @@ struct list_lru { struct list_lru_node *node; #if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) struct list_head list; + int shrinker_id; #endif }; diff --git a/include/linux/shrinker.h b/include/linux/shrinker.h index 86b651fa2846..22ee2996c480 100644 --- a/include/linux/shrinker.h +++ b/include/linux/shrinker.h @@ -77,6 +77,12 @@ struct shrinker { #define SHRINKER_NUMA_AWARE (1 << 0) #define SHRINKER_MEMCG_AWARE (1 << 1) -extern __must_check int register_shrinker(struct shrinker *); +extern __must_check int __register_shrinker(struct shrinker *, int, ...); +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) +#define register_shrinker_args(...) __register_shrinker(__VA_ARGS__) +#else +#define register_shrinker_args(shrinker,...) __register_shrinker(shrinker, 0) +#endif +#define register_shrinker(shrinker) register_shrinker_args(shrinker, 0) extern void unregister_shrinker(struct shrinker *); #endif diff --git a/mm/list_lru.c b/mm/list_lru.c index d9c84c5bda1d..2a4d29491947 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -567,6 +567,9 @@ int __list_lru_init(struct list_lru *lru, bool memcg_aware, size_t size = sizeof(*lru->node) * nr_node_ids; int err = -ENOMEM; +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) + lru->shrinker_id = -1; +#endif memcg_get_cache_ids(); lru->node = kzalloc(size, GFP_KERNEL); @@ -609,6 +612,9 @@ void list_lru_destroy(struct list_lru *lru) kfree(lru->node); lru->node = NULL; +#if defined(CONFIG_MEMCG) && !defined(CONFIG_SLOB) + lru->shrinker_id = -1; +#endif memcg_put_cache_ids(); } EXPORT_SYMBOL_GPL(list_lru_destroy); diff --git a/mm/vmscan.c b/mm/vmscan.c index f63eb5596c35..34cd1d9b8b22 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -188,7 +188,7 @@ static int expand_shrinker_id(int id) return 0; } -static int add_memcg_shrinker(struct shrinker *shrinker) +static int add_memcg_shrinker(struct shrinker *shrinker, int nr, va_list va_ids) { int id, ret; @@ -202,6 +202,8 @@ static int add_memcg_shrinker(struct shrinker *shrinker) goto unlock; } shrinker->id = id; + while (nr-- > 0) + *va_arg(va_ids, int *) = id; ret = 0; unlock: up_write(&shrinker_rwsem); @@ -217,7 +219,7 @@ static void del_memcg_shrinker(struct shrinker *shrinker) up_write(&shrinker_rwsem); } #else /* CONFIG_MEMCG && !CONFIG_SLOB */ -static int add_memcg_shrinker(struct shrinker *shrinker) +static int add_memcg_shrinker(struct shrinker *shrinker, int nr, va_list args) { return 0; } @@ -361,9 +363,10 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone /* * Add a shrinker callback to be called from the vm. */ -int register_shrinker(struct shrinker *shrinker) +int __register_shrinker(struct shrinker *shrinker, int nr, ...) { size_t size = sizeof(*shrinker->nr_deferred); + va_list args; int ret; if (shrinker->flags & SHRINKER_NUMA_AWARE) @@ -374,7 +377,9 @@ int register_shrinker(struct shrinker *shrinker) return -ENOMEM; if (shrinker->flags & SHRINKER_MEMCG_AWARE) { - ret = add_memcg_shrinker(shrinker); + va_start(args, nr); + ret = add_memcg_shrinker(shrinker, nr, args); + va_end(args); if (ret) goto free_deferred; } @@ -389,7 +394,7 @@ int register_shrinker(struct shrinker *shrinker) shrinker->nr_deferred = NULL; return -ENOMEM; } -EXPORT_SYMBOL(register_shrinker); +EXPORT_SYMBOL(__register_shrinker); /* * Remove one diff --git a/mm/workingset.c b/mm/workingset.c index 40ee02c83978..2e2555649d13 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -531,7 +531,8 @@ static int __init workingset_init(void) ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key); if (ret) goto err; - ret = register_shrinker(&workingset_shadow_shrinker); + ret = register_shrinker_args(&workingset_shadow_shrinker, + 1, &shadow_nodes.shrinker_id); if (ret) goto err_list_lru; return 0;