Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp696053imm; Tue, 15 May 2018 07:52:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo2lmPJ9VhkvVd9Kwsb/rFtp6RlDqzpuk1gHg6xxoz/VGjx/8/hajf5IRt1J+d5wqewp5qD X-Received: by 2002:a17:902:585e:: with SMTP id f30-v6mr14677111plj.50.1526395955385; Tue, 15 May 2018 07:52:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526395955; cv=none; d=google.com; s=arc-20160816; b=U+OlmsQdloGAhTQ9x0fnKMRJ+V6fOrxEYY9XGGSIV+RZE35jtv5P3vj8bA8uPasyJl D4/BswsIhZsEzAQaDzJFX1XgGvw8g45rZqUujERHcYniwITptgpn2Q8mZeeazf04gWP6 yI2yg4VLN20yrjouUiazSwRUzJ5q2oJ5Kt96n6FUDzF0Vhscj3ydzgXmi3YW0Jog+MXL AuSmDoj9F8YhFAHOtHaOXYnN+F1Rlo1DmtYNTtKVUHvGVfSpwQoideRaZpiRJ4GaSq4a uAxbBoJlQpzdRyEoLEDwuzHG6CK+IzII+XSdwM1TINR9yBfKaYHbKal03gjIMeEwuN6S tsWA== 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:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:arc-authentication-results; bh=3d5NLG9DC29iUpSzXCBQPUWVHIckYUrp89CVpEY4F58=; b=neo/UztavxZl4GKeu0b0h8NnxiHTEcuxi4x90Zakam0YVsl41IeSNJaYxhgbyypsvT T3Ur2Z8IlpVRNdRbbyi6nvXiERP2ZRoOvRaxSVwfyYvHDJnpo8Ck/g6Z9ylkfsS8iZpi J4+p6YCst/+WbtHCfbVp6eAWMBkNG2KLq0A8hQ+J9PQ4zFazc88j2oz47Dq4cZXEOE+2 YwBh2fszZmv8ZEgIiwIBNB2mLVwiDdz/JKv2TQVqzgwrDB5KVbZzPFSyvinh7FY/DFdg aRKFcg/P3vMFXUv7HxV2B3JjorjUBpI78a32OpjagsxGmPMpAJpmV1EsIBZ1/py9o1aY EVAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=YfIUWss1; 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 y34-v6si208428plb.317.2018.05.15.07.52.18; Tue, 15 May 2018 07:52:35 -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=YfIUWss1; 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 S1753468AbeEOOuP (ORCPT + 99 others); Tue, 15 May 2018 10:50:15 -0400 Received: from mail-he1eur01on0121.outbound.protection.outlook.com ([104.47.0.121]:43147 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752240AbeEOOuN (ORCPT ); Tue, 15 May 2018 10:50:13 -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=3d5NLG9DC29iUpSzXCBQPUWVHIckYUrp89CVpEY4F58=; b=YfIUWss1OhsuUp8Sd6kkDa/PWnHm/Y6i0A0IQma/bl3XKb1HkI/9PN21KcZffKimWvdVBqDeCkKHkLYMeOqf6ZNK1KRzP4FAR/WU9fi9HLUbjsvqFJ0AFcxMI/x/jsyUKaMiPyblUQbb35hoQmwv7XjmQL7k1B+KsY2zRiRzu/0= Received: from [172.16.25.5] (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.755.16; Tue, 15 May 2018 14:50:06 +0000 Subject: Re: [PATCH v5 11/13] mm: Iterate only over charged shrinkers during memcg shrink_slab() To: Vladimir Davydov Cc: akpm@linux-foundation.org, shakeelb@google.com, viro@zeniv.linux.org.uk, hannes@cmpxchg.org, mhocko@kernel.org, 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 References: <152594582808.22949.8353313986092337675.stgit@localhost.localdomain> <152594603565.22949.12428911301395699065.stgit@localhost.localdomain> <20180515054445.nhe4zigtelkois4p@esperanza> From: Kirill Tkhai Message-ID: <5c0dbd12-8100-61a2-34fd-8878c57195a3@virtuozzo.com> Date: Tue, 15 May 2018 17:49:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180515054445.nhe4zigtelkois4p@esperanza> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [195.214.232.6] X-ClientProxiedBy: HE1PR0802CA0023.eurprd08.prod.outlook.com (2603:10a6:3:bd::33) 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)(5600026)(2017052603328)(7153060)(7193020);SRVR:HE1PR0801MB1340; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;3:Zn9btT+wg+/ssDsnl9harsBlyHJbMWlV7kAXic3WmEhYnveoWU9dtmZtHCaLzMmYVl9nHYMlpVvNoH1AheXxPJBouSpcm/v5Z05ul0QJHpnA5vF4NOPH1zEkzL/nhpn5iVmyxj1vMTXiJJ/S7fSNjB8I5kp/5dMbaxoKz989LV1rww9zet5Nn2QF1xB7ZcapxiGY0Fv5mHp7q2jMiq7+qAjgf+AOr8mYw3FNWAXFMzjUAfzX2rk3DRx9rWUCIZ/7;25:vILlQ119Fn9K3gkzTQkuH1A7XHXNUBEubR6gOTuN8wPhWM8P+XPnzqdGHVZE8SQIvYGdzjyilz1Mn9XKCuLVNmmeg4wCAdZcBrl16ElzPm5ivQ6wBkuven7t0lhJy+ygG5ZADUJV6hb+cMTPtEGYY1pCvfx48TqqCtwg0/ZzGxdVxr5Y3rNAhjJV3GUw5PgebJKc4HBjP6aotulZFNg/fgCJryHmUQmusebmJjwGiwB7ipcsa1ndbxn2+E5WrbWMvgzQUcsyZCeIqYhvh8IqpSLb1j/38mXZCjnc60V+WVAjuK17qySo0yd/GX6BYbgH0qAtzI735qPxmNYoTAgZ0A==;31:tKjLpoZQfZiRTslGj3y1KADxX+cBcWE4GUC+hbj0YMYQXhbRuDp3VJBHqG1O+3a9XPyng/8quRrPUR2MwpObdWSBKbsH3/Qnv0ivFO2330m0+XHSiyCXVR+dpVcT4FYSVQpU+z76JJyicfE/9Jb+mx+d3h+aRwt//Ek2ov+eyp3ot2bPKj1SlZTRIt+TGFP2SA9lf//0MYhz3sS94+5vntddZu+M9QbXE4/Mgz9c7RA= X-MS-TrafficTypeDiagnostic: HE1PR0801MB1340: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;20:SyqFbIXEQORZiH6zHcMbUwlnBMGksyBYiDokbMbdSCGbanfiqo0+Z+fJjBuYO2+sKbMTDNpnDrq8Tm5CbeeCOW2yj8ON/6K5i2rd9qUhn0SKiiIvA4YQdenkp2PNFACKBPS4g1HmTVG7+iT/4Qq24Fz9+mnVaB4a/qRXB1xJJjIZ6BHGhhM8y0OeQlM4bHIHtIdhjDAkc5ONAumhSWXgMWrPMsgXHfX12rXsEUdHuc1vlTP6Zf3/R1mAak5yFTOycPHSMAkodkWXQhfNWtfY2/4TryX4flxQeUlC5IRqggsgQjsEKzhnfLcW+mqqPTWzT676CH37gipbmXWWlnzP7wFZ5ZknBuiUSIHPEEPKTm1fYSH5zrsLGVve+24dJwHIPHpVom3qQ1Rnar+rkjIaR46yN4HgYZA39vydyznMQwyWYRTvV+lQjsQTR8yyCMXLx+Zpp+mDV6txKIwctbyc+SYxgpK59oEp/TKB/xa2lNkEkt8YiaV3IQvPYKaMI6LW;4:Io0Ttowx+X75zGSkqnZqeejZ1YXfALNZWQVk3B0XeZOK2cYn08ZD5M+1ldkZZubSnF8QB6YSMEjr/uw8IQF5vv7eNbBMie4t8CrHLepJ1dsgHhmIAwCdxMhOuG3n0RqMTsl0Zw2lB0MpD6KWyN9JTg9fj7c3fYe9APg76/mH6uWR9KZ1xug1dNaoXpAFCW8Dik1bPZ3GS71o4RNd0o3pCP9dAYTUE+qb5tMgzuQKGlnAAa4TEAKI94sgJpiNGLJHoTquySWD8+JKFDF5hPhsIg== 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:HE1PR0801MB1340;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0801MB1340; X-Forefront-PRVS: 0673F5BE31 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(376002)(346002)(39380400002)(39850400004)(366004)(396003)(189003)(199004)(16576012)(64126003)(6246003)(65806001)(7736002)(107886003)(47776003)(8936002)(6116002)(2906002)(6486002)(8676002)(66066001)(81156014)(81166006)(7416002)(31686004)(3846002)(478600001)(5660300001)(65826007)(36756003)(39060400002)(68736007)(105586002)(4326008)(305945005)(316002)(229853002)(65956001)(53936002)(106356001)(6666003)(58126008)(6916009)(26005)(86362001)(2616005)(77096007)(446003)(11346002)(956004)(50466002)(230700001)(16526019)(486006)(2486003)(97736004)(31696002)(53546011)(59450400001)(52146003)(52116002)(23676004)(476003)(25786009)(76176011)(386003)(309714004);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0801MB1340;H:[172.16.25.5];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?MTtIRTFQUjA4MDFNQjEzNDA7MjM6S0dKdUtjajJTd1l0WldoTDJoUGVUaVVO?= =?utf-8?B?NmdRS0NXUWVzZEpWdmdINTdZeG0xTTd2SklTMnAwcEp4ajNPNGl1TXljOUhZ?= =?utf-8?B?YmgxVnVvK2NxUWFuV3BLOGFaZjJXenJibWJjVWd2MFJFNm96Z1UrTWRhako0?= =?utf-8?B?S1BkdmExOFdybGthZE1RN09sMWJlVEpEWWlzV2lWTlREbUwwcWc2RjFPTDd2?= =?utf-8?B?RmZIby9XV3JzazB5Z3cwVGRQemZkZzNMZ0tSMDlqU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microsoft-Exchange-Diagnostics: 1;HE1PR0801MB1340;7:GrzPTw1qhj+ojyy8XwZ9192JmU2R85UddbRtni12MBSn8ZEBAEjC93cQatWBPreFEjt5jYvR1kZZLcJLSmeIyN9Nft6yAQoz0issEEh2h5myQkBpMP7mSm3SRWxxuwnQtP37r9vbAGgGAN88r67ssupjJnxanIuBoHRGLg4vm950oBASQ4j+illTVHidWo2Gr5t+azcwPGdk/4zMO6Psq/MtfOJbJZB2VO/frykOpxku7F8xDZrZn8M3rKhDena2;20:Bt19nmYAzEPFX8CXkexuU8Ug9K4eJn7b22CSXwNaLrufUlKW4ulVQQuoqKd068iS5F9Ka8dVosdum8CeNRUbxU69ri7+f3wMbmpaDuUw/9CpjnieAm1oaTQnQRtusQq0lKH718j3UduSy0UP/rcAye2iBU71sUZdI6HL4EuhRls= X-MS-Office365-Filtering-Correlation-Id: 730e2fba-2d48-4f58-cb31-08d5ba7326c6 X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2018 14:50:06.8298 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 730e2fba-2d48-4f58-cb31-08d5ba7326c6 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 On 15.05.2018 08:44, Vladimir Davydov wrote: > On Thu, May 10, 2018 at 12:53:55PM +0300, Kirill Tkhai wrote: >> 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 > > Let's instead export mem_cgroup_is_root(). In case if MEMCG is disabled > it will always return false. > >> >> 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); > > IMO this shouldn't be here, see my comment below. > >> 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. > > ^^ > Nit: space missing here :-) > >> + */ >> + 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; >> + } > > The shrinker must be memcg aware so please add > > BUG_ON((shrinker->flags & SHRINKER_MEMCG_AWARE) == 0); > >> + if (list_empty(&shrinker->list)) >> + continue; > > I don't like using shrinker->list as an indicator that the shrinker has > been initialized. IMO if you do need such a check, you should split > shrinker_idr registration in two steps - allocate a slot in 'prealloc' > and set the pointer in 'register'. However, can we really encounter an > unregistered shrinker here? AFAIU a bit can be set in the shrinker map > only after the corresponding shrinker has been initialized, no? > >> + >> + 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) > > if (!mem_cgroup_is_root(memcg)) > >> + 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; > > I want this check gone. It's easy to achieve, actually - just remove the > following lines from shrink_node() > > if (global_reclaim(sc)) > shrink_slab(sc->gfp_mask, pgdat->node_id, NULL, > sc->priority); This check is not related to the patchset. Let's don't mix everything in the single series of patches, because after your last remarks it will grow at least up to 15 patches. This patchset can't be responsible for everything. >> >> if (!(shrinker->flags & SHRINKER_NUMA_AWARE)) >>