From patchwork Thu May 10 09:54:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10391557 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 8C23B60353 for ; Thu, 10 May 2018 09:54:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AB09289C4 for ; Thu, 10 May 2018 09:54:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E3F5289C6; Thu, 10 May 2018 09:54:25 +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 BA0F2289C4 for ; Thu, 10 May 2018 09:54:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A4B396B05F1; Thu, 10 May 2018 05:54:23 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9FA0E6B05F3; Thu, 10 May 2018 05:54:23 -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 8C3746B05F4; Thu, 10 May 2018 05:54:23 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id 44B056B05F1 for ; Thu, 10 May 2018 05:54:23 -0400 (EDT) Received: by mail-pf0-f200.google.com with SMTP id e3-v6so911604pfe.15 for ; Thu, 10 May 2018 02:54:23 -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=nLiaIQEkR6LvoUDFu1uhT04EtxhfvJavbLrRQPcdzuI=; b=ajb3OGA0iF6dFhM+/j3lT4U0rDGcGocDO07eyPRYaUO9GIRqlvR18AQIOgDwaYJipd OU6u3KwgYs05KurbwFo6+3wmUgHptTX5gntv8EA8QENgmjqIDPCiagc5eVkUvna7OekZ flTU5gXx9HyA3SmPWgGoC+e4EJXM7x1DtM10yIrjifypGItq3q0yxsu5RIewugm2uVvu Mlwdnl1p4NhENcAJryrg7WVr6MvEes6WfKXLMgGtuYPkS1PyO5CJ5yYUlFooH/jF3aLf PvMuhSgBIuiSUSlCjKppCc+pn/YKTfp+jovlGO5/TvUYiOiHrIgt+rgGcLKYST0Jf4O2 UTBA== X-Gm-Message-State: ALKqPwdK7BQEC/jNu6Qe23cXJoFjmJEXW008b4CqOxG4h04d3QED2lQJ 0RJIEcOPKjxD763cgwl4q7SxTp9sBaccEfB83iA0lSzjPrTt5bdqGP9CYBVPKVRRP0CxwhB77st 1Uq7UNRFjW88DwsMJ6LWH2ZL4ZZZW+KjPDKAaWY0EV9UHuxKjoYYj70DiaO/xEVJImw== X-Received: by 2002:a62:6c87:: with SMTP id h129-v6mr693838pfc.179.1525946062946; Thu, 10 May 2018 02:54:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrDl3WhcnarvxcLEkCdiNTSEfqrKN6tY/vBS1L8ojcGkzY9n+4yd+x8Flw4CcqEt8tYQMpR X-Received: by 2002:a62:6c87:: with SMTP id h129-v6mr693798pfc.179.1525946062034; Thu, 10 May 2018 02:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525946062; cv=none; d=google.com; s=arc-20160816; b=lfdgQGubAfeB9Bxp3wrpKRv+X8uvbTnqDlfXsGL7IuhvmxW877WIeD0N4bBEUZWsJm IS0xyCLglCCSFtTEr5Cfld6wqUp31D7Ly65j2pI3XKHaMsBvOGFo0NdNENQYK6LoqiT1 mF3Cw87fEqC0+vJtc4qvBslYJdt8TgIcLiL2ow/34TqiWoxAN1GRH9pyrkL6saG2aa0y Sww+K+UbxzOdbkwpQ/Fsvxfq1fTTSlHWui/2xusuO172lJ37t7xpqLPhIB8flUx9A/lc NYGK/VWgAXkvZnV6AJizMQSy3kor/08kcZg7ILmF8XnvsGjwTs/2veIPsJRXxA8lfMx1 FINg== 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=nLiaIQEkR6LvoUDFu1uhT04EtxhfvJavbLrRQPcdzuI=; b=HeqqB/5uyC+hla3vChSYx/cTlbui6qYeV5PfgQ/IE2BKeOPIAWtSX+mypEwqelJfBq OTCGejlkI9pUvW0+aF6DiP87NaMDhqmpT6NieF7bLvEuIFoT7bfHFWe1C5SKQGilNMyk bD/LK3Yirqx8VSDiU5XJx//Rf9DAbhN9AEQbPNG52t0GyTfVK3+AsW1KMlwJyMb16vOw PFx6QfDekGDO2uNyZkqWAU+i5mghZ1jpXFQ8Om0iVn9fPHgYJg5uJKIa7ggaARWIS+M2 Kpks68ilue+6ToTPaCizQFvgO7qYAzaErezge6ijUM4j/Lm3vfDGP+453xZbAnYbXPHj l0oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=HaisNl3n; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.4.122 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40122.outbound.protection.outlook.com. [40.107.4.122]) by mx.google.com with ESMTPS id z9-v6si495586pll.423.2018.05.10.02.54.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 May 2018 02:54:22 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.4.122 as permitted sender) client-ip=40.107.4.122; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=HaisNl3n; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 40.107.4.122 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=nLiaIQEkR6LvoUDFu1uhT04EtxhfvJavbLrRQPcdzuI=; b=HaisNl3nc8Dy3Rrvil4gfej6YX0+VBTgv3qdI+6HhJA8jdAaKQWd21hAkWUiPqmux/wbjMC6f492uIp3+JAkM2cEmPcEaHLxZbXTtKWORysYqbxP3H0c1FeRlWnTanIfDF2rF4ypAxrxN5rKZ/HDUNDh5rDE8xgpko5HRTk2IFg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.755.16; Thu, 10 May 2018 09:54:17 +0000 Subject: [PATCH v5 13/13] mm: Clear shrinker bit if there are no objects related 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: Thu, 10 May 2018 12:54:15 +0300 Message-ID: <152594605549.22949.16491037134168999424.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: AM6PR07CA0004.eurprd07.prod.outlook.com (2603:10a6:209:2a::17) To AM5PR0801MB1330.eurprd08.prod.outlook.com (2603:10a6:203:1f::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:AM5PR0801MB1330; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1330; 3:wOA2VU1zo7DPjoHvWgMYFiR1489peMvh+fZdmeTCF14gJ1eRHB+mhi/z6D8VM3elcyftNfog0tFJQUCOrKlecCsoU/KNwCan3PjM0+lE+IVJQ7K38A3hqWY7g9FdSD0WxOXZGIlzXDOwCPLB2BpuPqDLEBAFzTYtEaEQPIyX3V2M19Watx+4ASlRqvdunW7mCEWjA6KTSU3b7TsqGNl3yIGSWcXzb+NV3mbn14JI46ufyYKHJ+k52nRmH0ZEsGqn; 25:/q3C5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saxJgm9JQZWFc99NgdqMakUrXqr4aEYMHEMuA+DEwxmr6khNYI0vyS7Vo1lma+0zI7XVRGiPZi7aglMDS+M1e6BleQXE; 4:aUd2ZuYrZXbJKSe/5Uyd6XQRPB3S0TkoJ6wyqK2q4H+SO0kKA6PJac9UA3mk9hroTdR7ApS7aqs6j36/7cjcTrCjGYaWzfHYW7mOoVPrr9wn4lIccGqgxWANB5luDF/AqSpAJ5+Kpsdc869JSDnP7dPW6ForFEv52CdwGM7zZEXuljGIZ9LVKP+y7YBKmb7MU8c6DaspproYpt4YibfKYtWnfwo+pQfmT8AqplFjR631E7Gh+Hk9fPlg32LvUKW3uh6ogNeNwxVch3szh38cKQ== 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:AM5PR0801MB1330; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0801MB1330; X-Forefront-PRVS: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(39380400002)(376002)(346002)(366004)(396003)(39850400004)(189003)(199004)(305945005)(186003)(575784001)(86362001)(103116003)(6636002)(2906002)(7736002)(478600001)(230700001)(11346002)(16526019)(52116002)(106356001)(97736004)(53936002)(39060400002)(476003)(58126008)(6506007)(956004)(76176011)(2486003)(7416002)(68736007)(316002)(61506002)(486006)(55016002)(25786009)(105586002)(23676004)(81156014)(7696005)(446003)(47776003)(81166006)(8936002)(50466002)(9686003)(55236004)(5660300001)(386003)(66066001)(59450400001)(8676002)(6116002)(3846002)(33896004)(26005)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:AM5PR0801MB1330; 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?MTtBTTVQUjA4MDFNQjEzMzA7MjM6QUFBTnUvakJsNHNYRDNsTlMrSURSblpO?= =?utf-8?B?bkxGd1VneFk2R20vNlkwcmgzK0RnYTB0bWJObXhCMHBLZnVKWFNlMDBMSVVu?= =?utf-8?B?QmlVRi9vZTJwVlJDUWgwZ1l0NVpaWUgxYzVQMEMrOXJjc1V5QWtnRXEyS04z?= =?utf-8?B?S3dRSDNNQU9RUWVOMDlMcWhaOU1zRUhwVmZQRUlyNmdQWW56U0J5MFlhbDJL?= =?utf-8?B?Tk5Mdk9NOFA2cTcyU0lIZURtTUF3OEk2Y3IvU2pxSkc3ZTdzWFVoZ3NxQit2?= =?utf-8?B?VHY2OWJpM09PY1FKMkJlOVNwSGhpQzFlMDQrclBFY1EvNnBSaXRYVDd4Smda?= =?utf-8?B?SVE4RzJJZjIxZ09oNXFsdk9jZzNlbTJNRzN2SzZoOWE4dFNOMjYrcXpPUW9M?= =?utf-8?B?Y2E3THdWRmNoQ1hCL3RGOWJzeGkrWGNNTm5EV1dzTDkwanNVa25nSnRnLzJT?= =?utf-8?B?QUFnRFlNY2NDVjlvOXpkeVpQUTRVbmo5VGFqdlcrS1RCWE81Nys2YmpnYlFj?= =?utf-8?B?UzZ3MGkwQUppck8vS01ubUtFK0ZhaG5FUWJ1dm16MXdocVJxRTU5RWVldjZk?= =?utf-8?B?QjNLNjdqelZqbVloWStRZWdWaUdFN1R1dENDU3E3TTRFb2dmZzFSSEd6VGsz?= =?utf-8?B?TFNaNFdqMHlWME5mZEtUM0kyZlVVc2pOS3M0VDdHajlHZzhmT0ZvR1Y5OGlZ?= =?utf-8?B?Rmt6aEllNkxTNUVDTmxOWkZnb0NERmlCeGdWNTRjZWlwWkYvaU1lcWV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sXbJa1rOkymbOAKReHIv+zN5pvScpthzuIzRDmBLrIBZQYw6W00ZA=; 24:b57f852hw5E7gqGcH2BHeM5Lq/OgizoDLwh4mNiDiO0tF+qDrko5vCLc8F+aGYRJ3qRkV1Qgrr8rZKkkYoGZDeQ1YBkwrD0rW5GCRr4OQR0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM5PR0801MB1330; 7:B7Kwe5pQMqUN+ngdKIK9mZfdAg4ZuHFAOBgUtDu3tJwNYEsRsdZiWisb63ADoTU29EtfGYT+Z6thR611FaQaTis/Tqar8RK34nPq4ShAKhvejC022R6n/KZIr3gRV8uGX6RUbbvTqZcleX4rAJbxQbrnDZiIx/wXGYGXoKa1R6t6wLzCcUKSGIHBJpD9zyFkCMAk3ncfbeF2BsJIeL1xWPuvon7kwohzPUQxputlbZzEKDmQkkirJIO5xJqmS4MA; 20:jnBxuixnQsJ6HEnTuBKemO7O/j8eLBQFR6FmKjpl8VdGM3JlyOQudznWzH7o48s4mYa5feZSct4RRhtbyGIOnArKnwS92gYKpibKSjyOzY5dRNj3G/KVnj3nseZoOL/7uMtG0LfSrnRd4MnwIBFSVn9uD4A6JSJQfwGIQ5FKyuk= X-MS-Office365-Filtering-Correlation-Id: 1440cdf0-7536-453c-deee-08d5b65bff3d X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 09:54:17.0686 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1440cdf0-7536-453c-deee-08d5b65bff3d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1330 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 To avoid further unneed calls of do_shrink_slab() for shrinkers, which already do not have any charged objects in a memcg, their bits have to be cleared. This patch introduces a lockless mechanism to do that without races without parallel list lru add. After do_shrink_slab() returns SHRINK_EMPTY the first time, we clear the bit and call it once again. Then we restore the bit, if the new return value is different. Note, that single smp_mb__after_atomic() in shrink_slab_memcg() covers two situations: 1)list_lru_add() shrink_slab_memcg list_add_tail() for_each_set_bit() <--- read bit do_shrink_slab() <--- missed list update (no barrier) set_bit() do_shrink_slab() <--- seen list update This situation, when the first do_shrink_slab() sees set bit, but it doesn't see list update (i.e., race with the first element queueing), is rare. So we don't add before the first call of do_shrink_slab() instead of this to do not slow down generic case. Also, it's need the second call as seen in below in (2). 2)list_lru_add() shrink_slab_memcg() list_add_tail() ... set_bit() ... ... for_each_set_bit() do_shrink_slab() do_shrink_slab() clear_bit() ... ... ... list_lru_add() ... list_add_tail() clear_bit() set_bit() do_shrink_slab() The barriers guarantees, the second do_shrink_slab() in the right side task sees list update if really cleared the bit. This case is drawn in the code comment. [Results/performance of the patchset] After the whole patchset applied the below test shows signify increase of performance: $echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy $mkdir /sys/fs/cgroup/memory/ct $echo 4000M > /sys/fs/cgroup/memory/ct/memory.kmem.limit_in_bytes $for i in `seq 0 4000`; do mkdir /sys/fs/cgroup/memory/ct/$i; echo $$ > /sys/fs/cgroup/memory/ct/$i/cgroup.procs; mkdir -p s/$i; mount -t tmpfs $i s/$i; touch s/$i/file; done Then, 5 sequential calls of drop caches: $time echo 3 > /proc/sys/vm/drop_caches 1)Before: 0.00user 13.78system 0:13.78elapsed 99%CPU 0.00user 5.59system 0:05.60elapsed 99%CPU 0.00user 5.48system 0:05.48elapsed 99%CPU 0.00user 8.35system 0:08.35elapsed 99%CPU 0.00user 8.34system 0:08.35elapsed 99%CPU 2)After 0.00user 1.10system 0:01.10elapsed 99%CPU 0.00user 0.00system 0:00.01elapsed 64%CPU 0.00user 0.01system 0:00.01elapsed 82%CPU 0.00user 0.00system 0:00.01elapsed 64%CPU 0.00user 0.01system 0:00.01elapsed 82%CPU The results show the performance increases at least in 548 times. Signed-off-by: Kirill Tkhai --- include/linux/memcontrol.h | 2 ++ mm/vmscan.c | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 436691a66500..82c0bf2d0579 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1283,6 +1283,8 @@ static inline void memcg_set_shrinker_bit(struct mem_cgroup *memcg, int nid, int rcu_read_lock(); map = MEMCG_SHRINKER_MAP(memcg, nid); + /* Pairs with smp mb in shrink_slab() */ + smp_mb__before_atomic(); set_bit(nr, map->map); rcu_read_unlock(); } diff --git a/mm/vmscan.c b/mm/vmscan.c index 7b0075612d73..189b163bef4a 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -586,8 +586,23 @@ static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, continue; ret = do_shrink_slab(&sc, shrinker, priority); - if (ret == SHRINK_EMPTY) - ret = 0; + if (ret == SHRINK_EMPTY) { + clear_bit(i, map->map); + /* + * Pairs with mb in memcg_set_shrinker_bit(): + * + * list_lru_add() shrink_slab_memcg() + * list_add_tail() clear_bit() + * + * set_bit() do_shrink_slab() + */ + smp_mb__after_atomic(); + ret = do_shrink_slab(&sc, shrinker, priority); + if (ret == SHRINK_EMPTY) + ret = 0; + else + memcg_set_shrinker_bit(memcg, nid, i); + } freed += ret; if (rwsem_is_contended(&shrinker_rwsem)) {