From patchwork Thu May 10 09:53:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kirill Tkhai X-Patchwork-Id: 10391549 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 14C7160153 for ; Thu, 10 May 2018 09:54:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0287289BA for ; Thu, 10 May 2018 09:54:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3CA3289C4; Thu, 10 May 2018 09:54:05 +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 21942289BA for ; Thu, 10 May 2018 09:54:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF34C6B05ED; Thu, 10 May 2018 05:54:03 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id DA3D16B05EF; Thu, 10 May 2018 05:54:03 -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 C1EEB6B05F0; Thu, 10 May 2018 05:54:03 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id 7BA966B05ED for ; Thu, 10 May 2018 05:54:03 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id c187-v6so906189pfa.20 for ; Thu, 10 May 2018 02:54:03 -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=H32YWD1cM0yVnGiOjrbNIUiAwtkUBs3L/HxRaNiexuA=; b=t5aXRrxrfKP5+SLVKCbzT7uSZJtfU2fxVFTWJwxSAX1oOxGX62mDxK9JuqOM7SSY34 +FHBPo1LSZB3eEZolfOpwGi9AjO3ggYBummAWfb3tOLlH622pEqjCbau975CrHsqaLZ6 No5ZTYwjdOd1VCd52W2B8P9IiMvmnDVNDRKDyIFxg6LH1+z9c01kluxLBP89QiaqzJHV m5S7oRyF7a2doF1gTiw6ig4MmQ1q8cExkAE1qPGNs6T6BYqu8VxkntyRfNx16jvfdkTY +IQTECY6VV+8AwnV7fYnlsgqpBNLfm54bjr7W7LbvACebJVoEb/qjhzaFJ1V2cHUwLW4 csPw== X-Gm-Message-State: ALKqPwemzbs77mRtoXNzeNedufiGeLsmwhRgR6LOOOzTk8D04qNmynZF Pa60TJvQjDOu5PICtCDMaOxbJvy1jV3gnqf4y8RsMY4v7n13vwCSW5D2Nd6JipWV487UDhj1gbr gcYe2DCdqbiz6iII2ZoICyI/4BsWrGmGKaz43U227CRDV3BgzDTuEJCcmK2TyB749sg== X-Received: by 2002:a17:902:887:: with SMTP id 7-v6mr721763pll.319.1525946043184; Thu, 10 May 2018 02:54:03 -0700 (PDT) X-Google-Smtp-Source: AB8JxZohzxs8DRxRkxqrtAOuIbl+m37yRmFv1rtwsiy8b4MuqisimXunnJpuhQrARRyoGZ0XoW5e X-Received: by 2002:a17:902:887:: with SMTP id 7-v6mr721730pll.319.1525946042258; Thu, 10 May 2018 02:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525946042; cv=none; d=google.com; s=arc-20160816; b=tzm6552NdmSEvJ84IeQ6i1YKLYwIxPojyU5B1KP/mzz2UUkTnanwkW0L9yU+zpMGlm kKAL5TH+sjBS1ZSoShJMh0cw8SyNUyqozW3kKqBqRtPZXPhJ06CCs5p7yzDEcG8U+IXV BcIYmnNdDDutFgqHa5O7aojC365cSkNFnFkehSC7LGeWwW7RA/zQ219G2e9avj+q6zG9 eldvvU9y4hGj1h9nP8iF76lez7IJqhk4zNFEMjRQ9rqyEWCyHbfiW9YbxYVXtP0CibKA 503Elp3G/bXTCk8kQuZC2POk2mq580C7V9kGfKOsBYWcD0FIWHzjOTyL52mQGba4RmMq ykHg== 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=H32YWD1cM0yVnGiOjrbNIUiAwtkUBs3L/HxRaNiexuA=; b=ZZu9OS+m6IUSD/8exH5H94WTWC4lan4eFvdKYc2ikRgSMtpprwikPmf2zQoT8XuECg bF+SXehCTqm7B3/PyLIOJKbwIRMTasKxc2iYapoHmDAkSQ7QkqUU2ogoWargey8EkjNh m8ryHWnqLL9FjlqlEYUc6mL0zBl9+Kn8MJrBaBk8fDt3uUTq3nlHMRxNZsc0WgYcEK37 zLv4Oj4+5VHlDfSdNYHMc0HTEXIprMCR7cvhMCVOJ8M08xi8i//lhAkgam6qcGrwGRzA UzUk1GAtUW4vOFu2mTs8CsKINNZVE0Ez9GUiasNgDccZADiLQ8qViykU9FrlPthQSWDr xSLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Eu3L+Y1s; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.129 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-he1eur01on0129.outbound.protection.outlook.com. [104.47.0.129]) by mx.google.com with ESMTPS id j188-v6si385025pgc.94.2018.05.10.02.54.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 May 2018 02:54:02 -0700 (PDT) Received-SPF: pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.129 as permitted sender) client-ip=104.47.0.129; Authentication-Results: mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Eu3L+Y1s; spf=pass (google.com: domain of ktkhai@virtuozzo.com designates 104.47.0.129 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=H32YWD1cM0yVnGiOjrbNIUiAwtkUBs3L/HxRaNiexuA=; b=Eu3L+Y1sN3+Rvdrx6jqYhNichp32RyeB90UFXesDE7iBsy8k6kZX/ZsaVAX/NyR0lVHIhJjQCkFriqupZQyhzaEq9OS3OW61eXZQGewtRsN88CUVYx/a/Zc15bsZSLBp7AmJ0WbkyHBwJnBRIp0zEwEd+t5r/+eGNpgTtqqefjY= 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; Thu, 10 May 2018 09:53:57 +0000 Subject: [PATCH v5 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab() 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:53:55 +0300 Message-ID: <152594603565.22949.12428911301395699065.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: AM0PR0202CA0011.eurprd02.prod.outlook.com (2603:10a6:208:1::24) 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)(5600026)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0801MB1343; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1343; 3:NS3TSTt1ZB9jI8NHtEtdGDrWZ1Rhz1eOhOCxXho7DMwhjtaFcs6odn+L3jViQQaqF31zNeKJEndb+e6jI6ib9locRzIVIRSwopbkmh1Stup030wKwPIyh4OksVzujIOYCkh5ZmEpVwjv4B49xORMJWnEvnERsWGfeNzya9GH0IQj3RhmqhpBcjrMKO4svVZNeon9ZuAZmpPvuPnlVII1pq+coTNKJ+ID3bmccUI8s2K7TjDhNBhDCE/T4Aamw7Wx; 25:E+8LoXt2A/LZ8IQ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wEGGYpnub3Kl/RXeKhDSPbqspW6BamLEuSNGCVcBvSVCgnBj1r28AtOoBY/PqioY3P8urc06oRRBFG7VjOU; 4:UNeClYu+Bk4EctSah3i/RoYuIaHI+QZ2MLH8CM0dxD/pAb8vB0IWXoUWhdhvxPHdhRXR72try6y6Rbpua2jE2hVHAHbs3F95kPZOVkQ4wG4XaUa60uSA2N4rKUPt3zUexef8y5PDylBVD+K6AS7rMXCWBGstKTFlZaYGxOVE1NXoIzvZVM49c4JSOg9SiTB5sKB3mFbT1OHPw5Cmz3YW0MzP5JV69LeZ6VhgU6UVGYSp6EUpIHVwie7xdqwX7vmyFPu/GTaXY4JI2i7VJ5+55A== 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: 066898046A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(346002)(366004)(376002)(396003)(39850400004)(39380400002)(189003)(199004)(25786009)(6506007)(5660300001)(103116003)(230700001)(39060400002)(97736004)(476003)(53936002)(486006)(81166006)(47776003)(81156014)(105586002)(106356001)(8936002)(66066001)(956004)(11346002)(55016002)(9686003)(8676002)(68736007)(7696005)(23676004)(61506002)(2486003)(7736002)(52116002)(26005)(305945005)(55236004)(316002)(86362001)(6116002)(3846002)(186003)(16526019)(33896004)(386003)(59450400001)(58126008)(76176011)(6636002)(446003)(7416002)(478600001)(50466002)(2906002)(921003)(1121003)(309714004); 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?MTtWSTFQUjA4MDFNQjEzNDM7MjM6ZHkzNnN5eGhnczN3K0NDdHZSb0xlRm1M?= =?utf-8?B?VnZVWjdBVXBscmFxVkh0RUhZOHY3bWVNMUJtTElRamQ4ZHZsYnU0U2RTVVEx?= =?utf-8?B?VG9MQ1NVby9Ld3BkUm9WNUdIUnRGbmtjUUNlV3RuaW93Rk0wdVFUSzVKVStp?= =?utf-8?B?Z24zTFlOMjFSMXU0eHRsVWJzbzlFTW5EQTZvSys0azZJTDRrZVAySk9xbkR3?= =?utf-8?B?R0pWbnRRSEFsMDNZYmpnaiswcnBnT2RkRFhaUWV1OXRDYi9qM2Nycng4VlZM?= =?utf-8?B?UnJ2ZVpSQzBCVmI3SUFEanpaMWFGVE9sQ2luYzFiTENuSEtac1NwZTA2aWtp?= =?utf-8?B?a1pkbVJnemsvUDM0OU82WkRHaUJCUDZrSzZDRWo2NzVFUjNpQ1F6QWxxV3NI?= =?utf-8?B?L1NIaDlBeVZGd3M4cGZrRXorYkZENEs2VHF5SkFBZGlYellSMjZsQWNlRTFJ?= =?utf-8?B?bkszN1B0djd5Y3VGSVd3SnBJOTVKZmFhaHZTNE4zMjk0Ri95SHJXVCt4Vkh4?= =?utf-8?B?ZldqVDNFclpmNys3anNrN0dSU0FRRFNtZ3A5TzdBZndKYjZJT0ttSEM3NnpR?= =?utf-8?B?VjVOY3VtNyt3K3YrQ0NJL01IZXNxMmc0K05Wby9qdVUzRHltTVpodVNRRmYv?= =?utf-8?B?ejJOTS9STW4xMTRzM29RS1U2aXVubk9ob25SdXYyN0tuMzB1TllxVzk4Wk9m?= =?utf-8?B?M0orK1VkWXlFeTR0dXJaVU1zbmM4dmpkTXgvV0FCMHFHWUswbyt1MGZ3NlNR?= =?utf-8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3+Ltbu/m7dxWBEISOwqzjXOJIsMTwdD8ZdA=; 24:ueB6ZSkpGKmOsDy8kSUvaPFnBxaLWLV2lW/DQP8dut51uuETceG1DgcqCO1lLXQhH+QfyYTQEVjfEw5ewe17USVmHU6msBulkH0akzuU9sI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0801MB1343; 7:5eZGzmpb42yWJtI1GvtqY0JNfYL1btVZqRlz1bXs3QHp3YHSmljg1k0kwcc0RjzxJnlZpBLvbrB+L1l6Lj8w0TrqNGyFzX/+JWRSINQSPAFCVKinmJKdl3f/67gWe27qP0WS8hSMfLOXyqyYUpm+ONFbEErPv4wNHJ8YrU0Bom0/bUML4HvZXrCI0cdTMo4dhCttAAoqZ+aGL1L2YxPR6w4EfZhX4uuyVQoYQDihT9eyIuANdiiXv7hA3R/muGWN; 20:/zwUqcBszfCUPjwiffLy+5Pv3nbVT3aFOjcWeEcbBG6f4M3dt0gZBQDUjbEKGPIUY8ERuEYjqpgTiZjYgf/Y1JJRItZSHJs/q5f35hMVP7ZoiDSzzDzR+nSKOOnHf7r3+t3NzjSDCqZpAvnGAwKHWaNkf53VHvpD7Frwo55zYYI= X-MS-Office365-Filtering-Correlation-Id: 1ab96571-7986-4264-55c8-08d5b65bf3db X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2018 09:53:57.3559 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ab96571-7986-4264-55c8-08d5b65bf3db 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 Using the preparations made in previous patches, in case of memcg shrink, we may avoid shrinkers, which are not set in memcg's shrinkers bitmap. To do that, we separate iterations over memcg-aware and !memcg-aware shrinkers, and memcg-aware shrinkers are chosen via for_each_set_bit() from the bitmap. In case of big nodes, having many isolated environments, this gives significant performance growth. See next patches for the details. Note, that the patch does not respect to empty memcg shrinkers, since we never clear the bitmap bits after we set it once. Their shrinkers will be called again, with no shrinked objects as result. This functionality is provided by next patches. Signed-off-by: Kirill Tkhai --- include/linux/memcontrol.h | 1 + mm/vmscan.c | 70 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 82f892e77637..436691a66500 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -760,6 +760,7 @@ void mem_cgroup_split_huge_fixup(struct page *head); #define MEM_CGROUP_ID_MAX 0 struct mem_cgroup; +#define root_mem_cgroup NULL static inline bool mem_cgroup_disabled(void) { diff --git a/mm/vmscan.c b/mm/vmscan.c index d8a2870710e0..a2e38e05adb5 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -376,6 +376,7 @@ int prealloc_shrinker(struct shrinker *shrinker) goto free_deferred; } + INIT_LIST_HEAD(&shrinker->list); return 0; free_deferred: @@ -547,6 +548,63 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, return freed; } +#ifdef CONFIG_MEMCG_SHRINKER +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, + struct mem_cgroup *memcg, int priority) +{ + struct memcg_shrinker_map *map; + unsigned long freed = 0; + int ret, i; + + if (!memcg_kmem_enabled() || !mem_cgroup_online(memcg)) + return 0; + + if (!down_read_trylock(&shrinker_rwsem)) + return 0; + + /* + * 1)Caller passes only alive memcg, so map can't be NULL. + * 2)shrinker_rwsem protects from maps expanding. + */ + map = rcu_dereference_protected(MEMCG_SHRINKER_MAP(memcg, nid), true); + BUG_ON(!map); + + for_each_set_bit(i, map->map, memcg_shrinker_nr_max) { + struct shrink_control sc = { + .gfp_mask = gfp_mask, + .nid = nid, + .memcg = memcg, + }; + struct shrinker *shrinker; + + shrinker = idr_find(&shrinker_idr, i); + if (!shrinker) { + clear_bit(i, map->map); + continue; + } + if (list_empty(&shrinker->list)) + continue; + + ret = do_shrink_slab(&sc, shrinker, priority); + freed += ret; + + if (rwsem_is_contended(&shrinker_rwsem)) { + freed = freed ? : 1; + break; + } + } + + up_read(&shrinker_rwsem); + return freed; +} +#else /* CONFIG_MEMCG_SHRINKER */ +static unsigned long shrink_slab_memcg(gfp_t gfp_mask, int nid, + struct mem_cgroup *memcg, int priority) +{ + return 0; +} +#endif /* CONFIG_MEMCG_SHRINKER */ + /** * shrink_slab - shrink slab caches * @gfp_mask: allocation context @@ -576,8 +634,8 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, struct shrinker *shrinker; unsigned long freed = 0; - if (memcg && (!memcg_kmem_enabled() || !mem_cgroup_online(memcg))) - return 0; + if (memcg && memcg != root_mem_cgroup) + return shrink_slab_memcg(gfp_mask, nid, memcg, priority); if (!down_read_trylock(&shrinker_rwsem)) goto out; @@ -589,13 +647,7 @@ static unsigned long shrink_slab(gfp_t gfp_mask, int nid, .memcg = memcg, }; - /* - * If kernel memory accounting is disabled, we ignore - * SHRINKER_MEMCG_AWARE flag and call all shrinkers - * passing NULL for memcg. - */ - if (memcg_kmem_enabled() && - !!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE)) + if (!!memcg != !!(shrinker->flags & SHRINKER_MEMCG_AWARE)) continue; if (!(shrinker->flags & SHRINKER_NUMA_AWARE))