Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp905367imm; Wed, 4 Jul 2018 07:58:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsLtd3jaUwo2i1YIkdp+0gg6YWBcCpkQsxA0+v+BeSjv1zkKGGiRQP86Mm1eFaq5YNSdI6 X-Received: by 2002:a62:aa02:: with SMTP id e2-v6mr2494793pff.211.1530716336120; Wed, 04 Jul 2018 07:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530716336; cv=none; d=google.com; s=arc-20160816; b=MN7eJu4jEPG05oH2Q4fkqNyMxqjP6akbXQ678KCjPxAvUteardzgr8dP/i6P7gjg3M Wa8pgNT+rx5OMOsTE3BF5VGaEkd9aPdSE5oNIgfAqNWjNEKS1i2MdP+zXYEaZggzFFJH PyF8nNVy08BMJ4vdSSMJTVx2TLt2ipKqEXW/ovPrlS3u4jd2V37JE0/V0NaqXnFPukjR LfXntMy3fN4xFPrfGgAIJo9lGpYX/bljpCyC7hQdIPHtMPYzkDJvwt9FoTbjFGbqa5cj VKjbnfO201S9HeNoTjgOl0swrJe4duT0FotxitA513o73XIISIgfGWzvFo6qslcXXqD0 FrqA== 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=WkI0cW3AbEzGFgC7PTynHSlCu2n5vh/nCri3cT9Y2dM=; b=C/Iuu5CYKR1YipQXKA5Rv+O+ZELDcmDLjN6R5SjrdewNEC2BSwAQMbVrBH5cAmG/hD /RYnErDTLWqruMuStv1saTm2T4tBRaOtCSkMW1CJaye60n4QpCpukHrAqGOoIIKO9oEz ywxnMpSFd2jS7L7fI6BdvCU0xUqLCVF31hN9ZMcdTWg4jAYQzLWoHCaV+AjbQ1NUvGkk rfI6bU5jhOjLr35RBZQMmF0sCvuX4hNdCGnVcRRGioA9x+JAi2FJyWHjgkK7KNQpeuZK jBBjMsaxZunDJu68QG1/mhbQ1AjMPNLu366rNUYuKfCHZyBMp7bina90ScrzCCiOEHj5 USQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=Pbdml4t8; 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 r59-v6si3624975plb.187.2018.07.04.07.58.41; Wed, 04 Jul 2018 07:58:56 -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=Pbdml4t8; 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 S1753054AbeGDO4Q (ORCPT + 99 others); Wed, 4 Jul 2018 10:56:16 -0400 Received: from mail-eopbgr30128.outbound.protection.outlook.com ([40.107.3.128]:45281 "EHLO EUR03-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752578AbeGDO4O (ORCPT ); Wed, 4 Jul 2018 10:56:14 -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=WkI0cW3AbEzGFgC7PTynHSlCu2n5vh/nCri3cT9Y2dM=; b=Pbdml4t8tYfTN9GDiUGVU9SQ9NpFAG5cWNCRpf5+1lDE5Kndo394/Vz/Ld5z5EuxmfIqydWG/wUioFIi8lbRKV+duxyzvrLI+Ctsx2Zypc5IRgNCB2J59DXvhQ0aVmyh3PwNVmiD1y/MegaJVZdXqrF1iIjPaM8nVSCndMqYRag= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from [172.16.25.5] (185.231.240.5) by DB6PR0801MB1335.eurprd08.prod.outlook.com (2603:10a6:4:b::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Wed, 4 Jul 2018 14:56:08 +0000 Subject: Re: [PATCH v8 14/17] mm: Iterate only over charged shrinkers during memcg shrink_slab() To: Andrew Morton Cc: vdavydov.dev@gmail.com, 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: <153063036670.1818.16010062622751502.stgit@localhost.localdomain> <153063066653.1818.976035462801487910.stgit@localhost.localdomain> <20180703135813.ed4eef6a4a2df32fa1085e4c@linux-foundation.org> From: Kirill Tkhai Message-ID: <3fca0622-6f70-25eb-b023-2046c52734b7@virtuozzo.com> Date: Wed, 4 Jul 2018 17:56:04 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180703135813.ed4eef6a4a2df32fa1085e4c@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR03CA0050.eurprd03.prod.outlook.com (2603:10a6:803:50::21) To DB6PR0801MB1335.eurprd08.prod.outlook.com (2603:10a6:4:b::7) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 87ff5800-792a-43ae-ae20-08d5e1be4837 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB1335; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1335;3:d0IYeqqD8716tLheoTXuMWUK4dnvyWK8IoZD7hZp30n4J4sraXQROmUttUyjV7DA9l3Q0K4CrRImT2Xap0fjgbnbdxiuLGQLbIXL4Nn0kDc6npWULrrGapIyiw88WCA/Ea6GTZ3bBeDPmKTwrmNVJF2eFLZ8rG8OsY+RuF9zmD9Wncp9KTJoaSHDIcx7OhW207YdcsUlIj4TZ2TCfLMHk2rKuamrlhnn7Vua9vqWKHY/8bExRMXwYZzCKZ/k3B24;25:o5TT6Lofi5eSVsKSih5z+10PAYc/eWVMNB10CKAVfRuluonHSOJ+tCaVs7fTTKly23CFv81OUsNxnPzY9Q1bsq8qpMPO4do1SwfrG0z6bESB/ldS4kbPxvJVvLYzUI5sKQNYNloN4YQ2UrtHwOvB19F8dZBVZRaxxei0Mgw2glLzhObe9fA3FtjLEI53jKSVRfURudW3tP/14btzMMWkWSYHvKGCqE6kzXpkOho1B38YAL+eyMmOTNQz3gk0iJ/4DEdpK2odtQje5znFTTrxFLgNUnur/L+sQW398Y6nImIZ2xzvyG1bheIMVvXLyOxhJy8iJdns1hQaSZ534JuB8A==;31:8uzlhOYgCZrPm8+dcxCP6PcajING3zdoEZ79QBCBjugbH9GTEei97eCv8qb3JNAaTLP3B9W7M/KJPKo5fwHDMwNcAMya+STvbiCGlhrEmoeSuZsnvbCHNTDaqOxVz9b3Gg7g63tr7xZDcZfNW4PvT7jlXv5PnQfa2q1x6PausxIWbUHAAaOZz9ZfifbJ2yKJ6xeUmkDmzwWtS2CKRIWAPYbDchAcYfDOYdewVREFiYE= X-MS-TrafficTypeDiagnostic: DB6PR0801MB1335: X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1335;20:edTyWjH9WntcaS8YVbmd26uCSLg1KKFQsLgfV/VlOVvkj52Vo0TKOuNmU1qZDfyvVGEU0HuPH6zVfjtLVmmL1NvGbwjXl6UANNruIzjcUWPLSjt1iiwEUpf2dp5OKWBlWh5sVDnEoVb68VcuOsqNXhOPvB2iabixGISW9AFcH/8d9qdsFBb8iuJVKjAIVrLrDJgvCxBdq80QzPw5oMDMLsnlI/bjI8ppx5fi39vuXuF7Zkl3SkR+iBXA3ptJuYgtMHmN3HMKLeAkGzEKWHp6KDKvtMB9yBkgGZh6k/92lQyt+qBg5d1QSKC49f9A7wm5RFSvxdnwN6qEIB5CpuS8HQxeuCbNtQMy++fch9F8hCV32Mt8WP+kjgQRpfzXbvWL6iz4px5gIfvwB30NG8Cw/l1eBvZDI6I9cOGPILpXXTgbIx+Xjoq8qq1QyktrrZmB0dR6SqzdQfbE/uF0x1kKeHTv3kKuNggIbplne+b5wjGrIl+Q1zA0te7ZwJq00X86;4:M4i0bv6pnlTjs09hLbIPdyMJeW7twKb2qQsmwTBx1beBFCnXFcxQDTdvfT01+QvAfXddbAo4H87SFPA80FIxBWvBas/Rl98R+A7Lkc26EB+KLv77m0Mwxlm0ic3PSMXIEeJiyE96AyMrlr6N8NcFs5c8vK+jts1MYj06VEtVHMQe2N5bgJeh/ZGO2c87k5Q+/GNB2294lKH3+5kscHXi2hH+U3R3YI62QHk5Mit+edpIFt0O5CAJvUxVuD62tWi/kXC4pfXGJJBuNOfLg/xwSg== 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)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DB6PR0801MB1335;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB1335; X-Forefront-PRVS: 0723A02764 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(376002)(346002)(366004)(136003)(39850400004)(396003)(189003)(199004)(8676002)(6916009)(31686004)(66066001)(6246003)(52146003)(39060400002)(4326008)(65826007)(2486003)(5660300001)(65956001)(81166006)(81156014)(7416002)(107886003)(446003)(68736007)(97736004)(8936002)(86362001)(47776003)(6486002)(25786009)(50466002)(486006)(14444005)(2616005)(956004)(476003)(305945005)(65806001)(229853002)(31696002)(36756003)(58126008)(230700001)(3846002)(16576012)(316002)(53936002)(6116002)(105586002)(2906002)(26005)(6666003)(53546011)(77096007)(11346002)(106356001)(7736002)(52116002)(386003)(478600001)(16526019)(76176011)(23676004)(64126003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB1335;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?MTtEQjZQUjA4MDFNQjEzMzU7MjM6akZESnZLMS9tNndzV1NueXRQUEhScWt6?= =?utf-8?B?Z1ZyS3hXTUxqMVJVT0srYmUrR3VKUjJPNWExMFhobXkxbHExdVhEa0lDeFZE?= =?utf-8?B?RzlVYTBZK1Q1bXR4NVd6cmJjanZrSmF0VTBHY25XdWhXaVRnaFNGbnpubzVE?= =?utf-8?B?L0I3YlUzTXB3U2FhSENzWEZJN0F0WURrNkRUcFVmR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:HXFUfil07K2NL67C4JTxTzYgVjtfM9kpdzCX/r/xCm7mbeGNWFbWEOH1C4n35rK7LBN7g+9DgLcjoVuHHpbMf6GC4mVyhtrd559nWRwFWNc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB1335;7:u+JoF3IUDPmDBTWJiuRjWWeBA0OFnBSeHwkQIBlOmKj9qg0Z1GW3E3hZEvqX6/QxZSL/tPOKZRn3uWZFKEa2QTU7GrD5FzscZSsL0J9FppgOpFz3mb+Cdp5gl+dKP11CsdEDLw3NRMH8Rvd3sPHlwl2pC/+LfJnyroOWQKzzJ3rFC6NA+zJHw88wCc4nAUChXtugQBN9rxVHF0tLuSq6FZtMRYj5/g2eLRG9V/MRlIqTkb18y2cLxYR+0/hmE37y;20:vcbtPiwwNByYrBJos3IpH3YL0CEg79cDOPFJsdm8mbL6DJGPSwSQBNHLNdwImBbzIhsk7KXb3IZht4ur/+DwC9ETqkUGa1rzZoCmuNEEI67GVbMWVI9OdU8CZlbfF3ZY56SReOKipvU3lTa8I2mCLAjQggat8YMYMGgfyiP712A= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2018 14:56:08.5073 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 87ff5800-792a-43ae-ae20-08d5e1be4837 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1335 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03.07.2018 23:58, Andrew Morton wrote: > On Tue, 03 Jul 2018 18:11:06 +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. >> >> ... >> >> @@ -541,6 +555,67 @@ static unsigned long do_shrink_slab(struct shrink_control *shrinkctl, >> return freed; >> } >> >> +#ifdef CONFIG_MEMCG_KMEM >> +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; > > Why trylock? Presumably some other code path is known to hold the lock > for long periods? Dunno. We take shrinker_rwsem in prealloc_memcg_shrinker() and do memory allocation there. It may result in reclaim under shrinker_rwsem write locked, so we use down_read_trylock() to avoid deadlocks. The first versions of the patchset contained different lock for this function, but it has gone in the process of review. >Comment it, please. OK >> + /* >> + * 1) Caller passes only alive memcg, so map can't be NULL. >> + * 2) shrinker_rwsem protects from maps expanding. >> + */ >> + map = rcu_dereference_protected(memcg->nodeinfo[nid]->shrinker_map, >> + true); >> + BUG_ON(!map); >> + >> + for_each_set_bit(i, map->map, 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 (unlikely(!shrinker)) { >> + clear_bit(i, map->map); >> + continue; >> + } >> + BUG_ON(!(shrinker->flags & SHRINKER_MEMCG_AWARE)); > > Fair enough as a development-time sanity check but we shouldn't need > this in production code. Or make it VM_BUG_ON(), at least. OK >> + /* See comment in prealloc_shrinker() */ >> + if (unlikely(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; >> +} >