Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1382991imm; Tue, 22 May 2018 03:14:33 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqaXPRh6LRf80tYk342ub6EFTaMi0I77WVp0Ma/uiwQ6S+LqGemazz9/kw4hYcaDxbHcAey X-Received: by 2002:a65:6151:: with SMTP id o17-v6mr18953306pgv.120.1526984073513; Tue, 22 May 2018 03:14:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526984073; cv=none; d=google.com; s=arc-20160816; b=E1ien3D/ExI7VgjmUEjzkkicLBCjbzNbpkhYDSlEpVGNtOnxrCNwDAwqWamqDdxTBx pVEbX/Ray6VcIananKbSG0RgLLnFQ4vUmve9v6FIJI5OJaZTD56JGYLsgJ5ZGGMZLZqg cTbGYGHsbdymKVIe1+XvaYPIN2f2ZZn0GRseSbipRIcmIwwU4vrI86I6lXWncJbtYPqN kGMyxm+RccoNyWbKrMX4RfS8dr/J9wWT8Z+YCNOx418t8j57Zev8nMy7agCZy9HPYNPM QC5erv5BEgaBkS6OIWLugTt0gQHdE8DjZxGbjq/xkIseW3tRNGo0fa1N8f0TPwYEqynf c7/Q== 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=UcpA1xVHpPC6m0bhf9K0FnDA1027lFi/MU2HK9ZMr9U=; b=loR0xtraMfDzER9g6P9zFWrkKLmUr/Hazp3h7xpmF8Rp9SCixPUgtT24DidqVw9z9l pLexvwignhzgxqOycD3OXuSGTGVM6NK+kcIvwOo2Y9hkpdJLx16wQ37LEuVGKQ20PuFG zJdowWQ+vmNz17Q/BFuW2aHIHPWhRGIKgOlpInCQfj3j3Xv9CswTVkLpVDte7N9PZ0dt +zrvbx+okbDSyzB3JO7s4IbwPIV3PgG9dgpzaecbL8igu8MO4senvuHHmu7+UcS0snBL vJJRZC9y6g5veuA8w/7WJgDhACa6MFq8EG5THW6jSwPTEYFkdnsRgOIYBl1rlTDlD5lH 1xAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=fmKl1Ofh; 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 j22-v6si3740102pgn.609.2018.05.22.03.14.18; Tue, 22 May 2018 03:14:33 -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=fmKl1Ofh; 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 S1752186AbeEVKI4 (ORCPT + 99 others); Tue, 22 May 2018 06:08:56 -0400 Received: from mail-db5eur01on0101.outbound.protection.outlook.com ([104.47.2.101]:44868 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751229AbeEVKIr (ORCPT ); Tue, 22 May 2018 06:08:47 -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:X-MS-Exchange-SenderADCheck; bh=UcpA1xVHpPC6m0bhf9K0FnDA1027lFi/MU2HK9ZMr9U=; b=fmKl1Ofhvro+Qv3OkqE6wR/wLnC3MhZJQ07ec83cwI7Ue1iV/y/MhIrCojnLdGKMuV5SxJQOlA+/8o7azKNXSzEc/zOs2jGumuJqaiiAj4LdiTS0c/XQh50W1g9kJ/y1SGG4mUGobhQC8ADEhH2Dkd9VibnxhMGst81M4TEK4pI= Received: from localhost.localdomain (195.214.232.6) by DB6PR0801MB1334.eurprd08.prod.outlook.com (2603:10a6:4:a::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 10:08:40 +0000 Subject: [PATCH v7 08/17] 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, 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, 22 May 2018 13:08:36 +0300 Message-ID: <152698371665.3393.13441718686811755204.stgit@localhost.localdomain> In-Reply-To: <152698356466.3393.5351712806709424140.stgit@localhost.localdomain> References: <152698356466.3393.5351712806709424140.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: AM6PR0402CA0024.eurprd04.prod.outlook.com (2603:10a6:209::37) To DB6PR0801MB1334.eurprd08.prod.outlook.com (2603:10a6:4:a::28) 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:DB6PR0801MB1334; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1334;3:Ky0sQ83kC6wUuIuUsr9uaKb68OW+lK2j2JDMAj6qscUDmkP06UcCIBsncC2eauzHeBBmxx+hizgNXfPMYE8Y0barfhiYGtVW2WFwFopKbpTXTsdKOu0FG1xcOtjmPdjaefMGoPDEUJBR2kyMVomgXLWMstpZ1Q+alFg0GzoC9xNUWxR9RcO/RsgT+5KvAppLbdG0w/sIj90G6RnBJzIxpw9xqTRecipgrGU4Xot6f/KwyXlEJ5BPKkeFSLSN3gHY;25:DDe16HmcT9BmdHKbyBJMinSsmeu+OZw8YYFjpa5GyZW/D8UpiPgfCuJYCdE7Mes1PNlRt7E4BmBkNk4EjucD3w33sZYuG5vwdvWgY3IlTVq8tObxQYc554N5+M/ccPFd00B3buPvpDhNRa6464ai7yn++PcUnk9CbRLcfrVEIdm5chta1R/VtBMrTm43j/TFy/ukVqudxFkQgMeVud5z3kuremAA4E4ix/V+1jhLmLaRlW+l4q1d8dzKD9A2PICdcsD9rAGkq9e9zM/Xp1qG9Q693Kf34McpY9wrbbqG2o0AA1fcOY6qxOrpwmwObi13oYfqNw2YTZ0R2ZxVm8JcYg==;31:p5jwjbfZmLjwfMbjHPTcclYJ1zjhPPjfZjRxHvgOjRzSXzaGXXHHFqPkrM5EWCN9XaOG/iJtI4u6rklyZz/A/qsJSy10mBKZrvcJtoIZOhD7rYxCVt+UwUCI5Hyo4BNKYLEkDGq6lbo4jSAA/1LaytbGXkiREbp4sd61PhGtZPJCpP69r3IdinBDWprpJhy3ycfW+FAd9R/53ZBsPTycgp0wKo8qAfarpKiCK0AhtHc= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1334: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1334;20:Ppzgbhzg8EXyzMPzaBKQl/N8WQBLGEQZjX0K8lPzgRNOA5SDkuou2sGAVlzO9CaFDzOUEQPJRHTT5NUUVjooYZLe6rlWJaSHhffKGe33y8/DHJNh8MzMj/vYjsA1RtXEUV8hapHWCa0D6vBBX4uudLpQIvOMX3ngEU1p9MQEXBvX58LePyDeU20vVWbfh/C8EMDA+oWy/A3Ri1k/uto2D1P37BX8dS/M1xtaEHZbRRJ7TSwbSwyamN8o4y85k7vE0REaKE9S3jdzGubfQRQDJ+OBaO0MNTy1iyfJcVJXgLeMrnbkYZu4nr1fMHC9ULrmBJXWSWsmhnEJZ1JMY8rebA2q3XF6Uocg35iicKSwRt2qpD5nkWv4tsb21ntOWs0cpLsnCTYQRDN9OF9i3RXZC5nmGFLgUthyES4yfeEWQzJe6j7drbqrKU4KXgz7ksp51HGnjb+PoB+yhSzL4tPB7ebsK+A+hS29DE7Dhw6u2SzR93e+dHFRQg6HbZh8ZfoG;4:wabBhGxMSD9on0veZsI//fkRLHOQrEAkgYQFAafktsFzPhm1WIpVlCc6uiEsbtf63YPcA1n8klmDYjbBAnRZ7IrD0BIi9/WXLYIIbCDPtuue8ovMZk0V7qAkMJMP/whBQhNFTjnoI96+9mEPz6V+588TGBOZqm9Gjz5tZL3jMJfApECh153SV/hgmJSigln1bhzauLkh12yre1eeB46EFhEg4Gu/yCKrTgFKvF0Qg7KXO/3KjFxKCb+mWzV3yWkyTywfO2gicq/xbhsmQDLGlw== 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)(8121501046)(5005006)(3231254)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(20161123564045)(20161123562045)(6072148)(201708071742011)(7699016);SRVR:DB6PR0801MB1334;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB1334; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(39380400002)(346002)(39850400004)(376002)(396003)(366004)(199004)(189003)(11346002)(486006)(305945005)(81156014)(186003)(230700001)(55236004)(6506007)(386003)(16526019)(8676002)(81166006)(53936002)(55016002)(9686003)(50466002)(26005)(6636002)(2906002)(6666003)(23676004)(39060400002)(2486003)(8936002)(86362001)(575784001)(476003)(59450400001)(33896004)(956004)(7736002)(76176011)(97736004)(446003)(52116002)(3846002)(7696005)(6116002)(25786009)(316002)(106356001)(5660300001)(478600001)(68736007)(61506002)(58126008)(105586002)(7416002)(47776003)(66066001)(103116003)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB1334;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?MTtEQjZQUjA4MDFNQjEzMzQ7MjM6ZVpaTDRRWGZBcTVnS1RHaG9heHVzcmdU?= =?utf-8?B?QUd3ckRFSy9BcHQxUHZEYzlKMnlCUnpXUW1GZlVqdktpNFFyc0ltaDlVeTJw?= =?utf-8?B?ckdyRFVEL2o1QlhpM0ZnS1hSejFVajAwL1BSUktXOFFTTmo1WGt1ZmpBNXlJ?= =?utf-8?B?ZGgwdlR6czY3RUFpTFBNczFaMFg3Y2NnMDZBVEtWa3RucVlYeUthYjRIdEd4?= =?utf-8?B?N1VyNzJKYTZqTDd5N0lLQmtQbXd6dkF5MlNUKzhLTDhIYXE0ZEhKZnJzSm1H?= =?utf-8?B?dFVDMEtyQld0YmJ5enI3dEJaT3RqL3NSYlpRQlQrY1lIWEMzQ2RIVmdiY2RG?= =?utf-8?B?WnVRZmN2Q3REM3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E4mTQMwzQii+0SOVZrYM2bvDau9nYwUxm6LPQLQdaFgH6LTrtayNwDx5RErxcw3pWOilHXU8W4UeG4nJTeqp2xY88iAeM4rMnXMS0suqZU7Vg1J1bCJbs= X-MS-Office365-Filtering-Correlation-Id: 0eb7fcc3-8b93-490a-35ea-08d5bfcbfeee X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 10:08:40.1270 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0eb7fcc3-8b93-490a-35ea-08d5bfcbfeee X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1334 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 | 14 +++++++++----- mm/list_lru.c | 11 ++++++++++- mm/workingset.c | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/fs/super.c b/fs/super.c index 78227c4ddb21..f5f96e52e0cd 100644 --- a/fs/super.c +++ b/fs/super.c @@ -261,9 +261,9 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags, s->s_shrink.flags = SHRINKER_NUMA_AWARE | SHRINKER_MEMCG_AWARE; if (prealloc_shrinker(&s->s_shrink)) goto fail; - if (list_lru_init_memcg(&s->s_dentry_lru)) + if (list_lru_init_memcg(&s->s_dentry_lru, &s->s_shrink)) goto fail; - if (list_lru_init_memcg(&s->s_inode_lru)) + if (list_lru_init_memcg(&s->s_inode_lru, &s->s_shrink)) goto fail; return s; diff --git a/include/linux/list_lru.h b/include/linux/list_lru.h index 2d23b5b745be..9e75bb33766b 100644 --- a/include/linux/list_lru.h +++ b/include/linux/list_lru.h @@ -53,16 +53,20 @@ struct list_lru { struct list_lru_node *node; #ifdef CONFIG_MEMCG_KMEM struct list_head list; + int shrinker_id; #endif }; void list_lru_destroy(struct list_lru *lru); int __list_lru_init(struct list_lru *lru, bool memcg_aware, - struct lock_class_key *key); - -#define list_lru_init(lru) __list_lru_init((lru), false, NULL) -#define list_lru_init_key(lru, key) __list_lru_init((lru), false, (key)) -#define list_lru_init_memcg(lru) __list_lru_init((lru), true, NULL) + struct lock_class_key *key, struct shrinker *shrinker); + +#define list_lru_init(lru) \ + __list_lru_init((lru), false, NULL, NULL) +#define list_lru_init_key(lru, key) \ + __list_lru_init((lru), false, (key), NULL) +#define list_lru_init_memcg(lru, shrinker) \ + __list_lru_init((lru), true, NULL, shrinker) int memcg_update_all_list_lrus(int num_memcgs); void memcg_drain_all_list_lrus(int src_idx, int dst_idx); diff --git a/mm/list_lru.c b/mm/list_lru.c index 232bb637cf02..dde9ecae7cb5 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -559,12 +559,18 @@ static void memcg_destroy_list_lru(struct list_lru *lru) #endif /* CONFIG_MEMCG_KMEM */ int __list_lru_init(struct list_lru *lru, bool memcg_aware, - struct lock_class_key *key) + struct lock_class_key *key, struct shrinker *shrinker) { int i; size_t size = sizeof(*lru->node) * nr_node_ids; int err = -ENOMEM; +#ifdef CONFIG_MEMCG_KMEM + if (shrinker) + lru->shrinker_id = shrinker->id; + else + lru->shrinker_id = -1; +#endif memcg_get_cache_ids(); lru->node = kzalloc(size, GFP_KERNEL); @@ -607,6 +613,9 @@ void list_lru_destroy(struct list_lru *lru) kfree(lru->node); lru->node = NULL; +#ifdef CONFIG_MEMCG_KMEM + lru->shrinker_id = -1; +#endif memcg_put_cache_ids(); } EXPORT_SYMBOL_GPL(list_lru_destroy); diff --git a/mm/workingset.c b/mm/workingset.c index c3a4fe145bb7..79099bc5c256 100644 --- a/mm/workingset.c +++ b/mm/workingset.c @@ -531,7 +531,8 @@ static int __init workingset_init(void) ret = prealloc_shrinker(&workingset_shadow_shrinker); if (ret) goto err; - ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key); + ret = __list_lru_init(&shadow_nodes, true, &shadow_nodes_key, + &workingset_shadow_shrinker); if (ret) goto err_list_lru; register_shrinker_prepared(&workingset_shadow_shrinker);