From patchwork Wed May 9 11:58:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10389295 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 C8DFE60236 for ; Wed, 9 May 2018 11:59:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B38FB28C59 for ; Wed, 9 May 2018 11:59:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A813828EBA; Wed, 9 May 2018 11:59:09 +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 E6FBA28C59 for ; Wed, 9 May 2018 11:59:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3D9F6B050B; Wed, 9 May 2018 07:59:07 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AEC336B050D; Wed, 9 May 2018 07:59:07 -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 9B47A6B050E; Wed, 9 May 2018 07:59:07 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 48CAD6B050B for ; Wed, 9 May 2018 07:59:07 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id x2-v6so3632856plv.0 for ; Wed, 09 May 2018 04:59:07 -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=i/a1HIgUYQdtVnmKvgsW8oV2n8FbgtIS4Ng05Lnt1zQ=; b=hzSkiET35KOdKO0Q5wkMUPOJi3AF9RPZtu7s2+E6anQuAgYPN/Kz6EA9woaC8koUUh Ekg4JcU2SyOXn55p5ImPCci3gQJKjwG6BBKlUZtYYB0bxhvQpiRlPkX8lVUjkzGgzddH R2LomFX4KWMiTtF/VPGZQ6vvoSQp1mkACThjTKp0xwGOqFUCC/geQib9hjIXjw6ywf3+ +R3ogSIa7VXoZYQ3ZZZHTdVEWKn7iC9NWzMWfm7PPO/fth1JJvRmABif78kvX6T4F2kO UUR5WpE4f1laaBQ8ICoVAIjVlzAhyr5I9pv0G/Wfq72pzIeejey2oy/hghLz8v1nzVDw JPZg== X-Gm-Message-State: ALQs6tA1sLKFzsSzBZBioZh5L8qEmUUjD/33nCcD+Kkd8z81CUG4zxi6 8KLhnya1HolovPh63O3I7GFrq9i2TfUXuQMO3wmdCw03b/fbgtOHK8Vl01eP4oy164qLD36Oo65 dZ6ZOSVoSIlg+E4acHezM//WpGuVGuAprXPhLJLiL7+oH0yNtRuDta5BqQRh5nApq7A== X-Received: by 10.98.12.21 with SMTP id u21mr43010680pfi.218.1525867146969; Wed, 09 May 2018 04:59:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqX58/LioMp9m5+jxpqSeH7ArP0p/5BFU5zkk/6c6SGeS9PJmPLM0WK8sDqpzd+b1P29xhN X-Received: by 10.98.12.21 with SMTP id u21mr43010633pfi.218.1525867146089; Wed, 09 May 2018 04:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525867146; cv=none; d=google.com; s=arc-20160816; b=dtufEAxHeE4UCCth89lym9Nb0ft7orZujKRZ2cWxeb2hR9sFvf/IFiYQ0XSw035Nbp aU1eNTCKnk4DcLzfh/wcPbTIhYPP965Mqeit39Dzq0gtQNPWDM2deMZtRApyWUDnGRsY wvQpXyibUQLu2SdzSAXBBvSWkwUSLZ6LSHmP9thqettYqqBxqSy7hqxLlDZHkJE4ZVxX vehgx0yS9ffjpj8WSjDSSkmimZ2jU2l07r0AJHhaDIHBtBykYorTOHqXkue+NVRg8815 O6KU+c/FWBsc0RIs8GUBweRzgUgRotiNgHQgM60gYvBLDcJGRsqxo6o2JaaVhzgYtOGV vMXg== 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=i/a1HIgUYQdtVnmKvgsW8oV2n8FbgtIS4Ng05Lnt1zQ=; b=QIwHJqp+yM6UiRAy7xepoFls6zAv7O3xEPwMJhHklED7d4ve6pv5m/HdveBgErCbrn yWARxGSDCKAaw+7Xh0K0LbcjgoYPuvV00vupGwVum0HMamCfnOCDUmUKoLypRIblwChK C79YPPfvcM2jfYbgwcWC9G/yEuNH8zFKbmomiVHpcV08tEQoBMg19sp5xrgNj2IdXYU6 3jkD4uivnQJNoOPh2wUCWDaHbZi/EFn0leK5cwr6vvL1zQK4qLUb/Zz8ERadM9Tb67Q0 tP2cvRDCDRLqPgcXIQyZQCJkjJKjUHmao0qiq7rlYd3kkF4YyxHZfqaGhn5Er02Rlymz uRNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Qt9Dgf34; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.138 as permitted sender) smtp.mailfrom=ktkhai@virtuozzo.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0138.outbound.protection.outlook.com. [104.47.0.138]) by mx.google.com with ESMTPS id 1-v6si945429ply.226.2018.05.09.04.59.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 May 2018 04:59:06 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.138 as permitted sender) client-ip=104.47.0.138; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Qt9Dgf34; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.138 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=i/a1HIgUYQdtVnmKvgsW8oV2n8FbgtIS4Ng05Lnt1zQ=; b=Qt9Dgf34DRPbvvBYC1RZZE+WnMD0cCH3AbyVBwrte1tMdNQY3omI3iL46q/qKbKFilSXbyb/a8ZiYmOQRlcUxs1MZk4NTs3SbYkxOMN/dL5d2UJ8w2p8ddTkyBQnv/4Z7siFaS2fRQY52T7f9xTKEEHCf7QCXcSGihsXNDVBYPQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from localhost.localdomain (195.214.232.6) by VI1PR0801MB1343.eurprd08.prod.outlook.com (2603:10a6:800:3b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.735.17; Wed, 9 May 2018 11:58:59 +0000 Subject: [PATCH v4 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: Wed, 09 May 2018 14:58:56 +0300 Message-ID: <152586713627.3048.6958181425724648686.stgit@localhost.localdomain> In-Reply-To: <152586686544.3048.15776787801312398314.stgit@localhost.localdomain> References: <152586686544.3048.15776787801312398314.stgit@localhost.localdomain> User-Agent: StGit/0.18 MIME-Version: 1.0 X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0802CA0022.eurprd08.prod.outlook.com (2603:10a6:3:bd::32) To VI1PR0801MB1343.eurprd08.prod.outlook.com (2603:10a6:800:3b::7) 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:VI1PR0801MB1343; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1343; 3:xO004wiJGevn+WZLmNwmDdykUS2hlVrZNxzCPnqQ8ZzuAB4pIH9894/OzY/BVaDL4tabFv8lFZI+gQYAbqgp3SKks4VZTwo4xEQ1q/Lzv046H+kooJ79PWdDkLvW3KvxWehjrlp6Tn90xE6fsm9wcwGuKVnKvL+0JP85/Tk7lGJ8g0m3PajWRSljVAW/Jur8QXQQe8y8Fzzzm/VHCjgrSixTSbqXHaRq0n1VNpGzMhy+9KxSyo9C+aBhwZwxnpJe; 25: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pyvg2pjydS1RyAzscXiIY2VaBMJSFCoMShVBrEo4fu8+XrO8rvRjLONRPN8ndT05CfzDcfJ0fCA/vwZ/9YruYPD; 4:JvhdcOzwz1chgHWn0q9IW0aBJfguhSWMXU+9OTZRFHCuGLQUOpUFejkbJ8h7aQv/T3WAN83QAvfrI8JSi0Nodf6wNIm+SNMhUc+sJNiPdupFNG2CMQwpbMvvRlWOhWoZM8r3AaVBr7OsoyvcPX7tzwRJuRUFE/45mTTn+sJS1vROzvHzLtq5Ra7rFA2KyzKopAtU5jtBUeIUpW8gF5fMcbfL8OLle/+MQnDGFV4UMqbPgAmRYbBxfMOvoHVj3z6+xu8X7/Ozo9zNrqRjtN64AA== 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)(3231254)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:VI1PR0801MB1343; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0801MB1343; X-Forefront-PRVS: 0667289FF8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(396003)(39380400002)(39850400004)(366004)(346002)(376002)(189003)(199004)(7416002)(6636002)(186003)(68736007)(26005)(3846002)(6116002)(55236004)(86362001)(316002)(2486003)(305945005)(23676004)(61506002)(52116002)(7696005)(7736002)(446003)(478600001)(76176011)(2906002)(50466002)(6666003)(16526019)(33896004)(58126008)(59450400001)(386003)(6506007)(97736004)(39060400002)(230700001)(5660300001)(53936002)(103116003)(25786009)(11346002)(956004)(9686003)(55016002)(486006)(476003)(105586002)(81156014)(47776003)(106356001)(8936002)(81166006)(66066001)(8676002)(921003)(1121003); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0801MB1343; 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?MTtWSTFQUjA4MDFNQjEzNDM7MjM6NVlqNUFYNHRrUFl6RTdVTGUrMnoySzN0?= =?utf-8?B?MzhVR0dReVR3cUZjK2lnay84SCtlMCt4bWh5cnZMMzdCZ0dqNm5mTGI5RTNp?= =?utf-8?B?enFzL3l1VFB3K3VONTZrbzh0czBaN0ZYTlFycG1iRHRzODI2RkxBVmpUS3RJ?= =?utf-8?B?cTRraGdtbkFiZHJPMzY5MmpyVzJkRWdPYldGeFdhL1dJSVlRVjBOVm9OMTFz?= =?utf-8?B?N1hkOWMvbyt6aEhIRG1ZQmhvd2dCUTI4SmUvWE02a1pUYXBDNklGRTBXYmZm?= =?utf-8?B?ekkySlhlRVYzMDMxVmo1d3NDcEViSlE4eXlyczFUZzQ3V0FUUm83aXhheUk3?= =?utf-8?B?c1JiWnRhWXhXQXdkWEkzQzJteHdrV1hYbXVpaENKaUV1VUM1QTUzUkdDVUQy?= =?utf-8?B?LzNKODMwdXF1NXBUTWVoc080K0E1allGdmo0MVNxWWU1TkJYQTFyV2RPN2RZ?= =?utf-8?B?R0N2aDRySHlQRFdUbXJjMXd0NzNRd0JMUGxweTJKbzFTTDY4ZUhuR1UzbTJ1?= =?utf-8?B?VmloQXludmVuQlFvVGhDSjN0VFJycjcyOHYrY3ZMSFRNUzBUakl4QzA2UHd1?= =?utf-8?B?akFWUUdyc1htUm5TakdaR1RuaVRaVnBOR1ZrM3A0aldML1NHTERaTDNBTUcx?= =?utf-8?B?Q0lBYUoxRnJMbERzZzRId2dpSXB4RUdKVlg0Mlo5U2dGcS9aa1lkdVhleUFk?= =?utf-8?B?UU5uamZlSzFJL3B3MDU4eDUwZVo5T3VZa2hISHFxczNuM2VYSWY3U2dJT28y?= =?utf-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XSQ+5xEULyzlMO41SnamyqSEHum6dEHLd9M06pz11LLkePv23I/tdavHw9yjas4o=; 24:IPrCBnKKev9zRKECdl7OvvST4EgS9mSFwRzs15+GYBxhAXqYGpCuGN+sXjxopZ5LfH4akPYRmBrY/ZqlcmQXRNr+XvzctxjGRfj0zVQyu2U= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1343; 7:EpnejaIYqjzLV23XpmvFjXSk9m2oHOjxiPM8zTyhXlTQTa7vZC+05IoZkbyKf7D5RBaCulmYglb3oejulaUClV5wf0NbO1kYho9Zw57bxnLdsZTXQI9UP/S/tiDl1CstZ5hC58wzNZg66ykj75tQ3aXPAPBNIWQUUOei3rOXEv6Gxpirw5voubmnzM6DiMMYPu93fTQ9OVqQorMH5cPuHG32mBcVmnC+MBzAIhDD7VuTiZZYa2O1LsMjMCGzCfUQ; 20:ZMa9LrWI3MpOaM1yzgowoAMQPMXtGlrrqqlJ122V3jTqBISBjNmFh9OvSyLaIicxoSmZthl5CYSYO5zIR833KMJfLJducAg11i1JbNUaWhkFSoH+NzF3ARBRRpSKN0hhc8Wxoh21Gv5Omv6Fm5v71UdW/Q8G1Hb0B4HKAf98WHA= X-MS-Office365-Filtering-Correlation-Id: 5662fcfd-f634-46c5-f8d1-08d5b5a440dd X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 May 2018 11:58:59.1283 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5662fcfd-f634-46c5-f8d1-08d5b5a440dd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB1343 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 4548b09e44a7..9f00554aa59c 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1255,6 +1255,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 80743878576c..49cdf9a17d6f 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)) {