Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1813865imm; Thu, 9 Aug 2018 02:23:17 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzBX0wr1W0FaXj4kk5c/FzIOTm2N05H1sCwfVuNqLY5SHoSo6OOUC41Rn1YftaPSmXvkUSK X-Received: by 2002:a17:902:b785:: with SMTP id e5-v6mr1319438pls.339.1533806597876; Thu, 09 Aug 2018 02:23:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533806597; cv=none; d=google.com; s=arc-20160816; b=ki7gIMj6tjbZ29HRM5g+xyVJb0w/bTf5TOHQxi8vw2vb2gQhcuWHKRMFdUhP17xuaK c2rNghJcuvGYiuG0miuGL8mSi0q7tnIk0wobV5I26LwHydPMaIHKS5oaqUDu4Rj7sOXk C6x6x1Xwlye0AuC9bkvWKcXP8hB2rO0ekCKqzP7qbIKOz9bNMn/R7vhnZff4myxnNVkE U7L2Gk86JHuY8hs2zKQp3kwGkOcwaPoYLqYZ4tpeEOJiDueC36Ucfmj8qUN/G/sq5c69 YAelY4GvzCwEQ/MwHWe+rr8MrUfymGVYULB76C0/ptP6B8YAhglBYwrCzDlHVMKTfocv LxWA== 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=SSzvySRpLU0Nyp3YRv+jSAaIAgnuIAh1mMVNyVj5vag=; b=XouX8CH3TnYjiMvar6qc1Fq5xXh0w/A+fgza93h+EY3xGLGTy7URTGe3lgBT6wGXH+ GAbGxaWZKSgSUkoOTINIW7CgyK8vDvQ7tupK/IHnRTSEbApelfHbq4svIE75Z30lrqq8 QnK9m1vHHIrjlbgUrlkg8Y+p/aqlYbWnfFw9CJKKEmEi/221kq5lQxWpriaL2lhRzk1u 9NfaiqKgqxKn+JFc1ItIW71LCMSX5V8diTAxP4QVhHapW+g2p9g1jC6JRP09CcSflmnC SFm0zzjCvLWUY3hIGjuNCBCZUTd12jPeJqZXzMKSMLRG2pzug17A63XEFMNXM3+7YYOe 6F+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@virtuozzo.com header.s=selector1 header.b=bG0RAYiP; 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 d1-v6si5128161pgv.76.2018.08.09.02.23.02; Thu, 09 Aug 2018 02:23:17 -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=bG0RAYiP; 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 S1730163AbeHILqM (ORCPT + 99 others); Thu, 9 Aug 2018 07:46:12 -0400 Received: from mail-eopbgr70127.outbound.protection.outlook.com ([40.107.7.127]:28416 "EHLO EUR04-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727579AbeHILqL (ORCPT ); Thu, 9 Aug 2018 07:46:11 -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=SSzvySRpLU0Nyp3YRv+jSAaIAgnuIAh1mMVNyVj5vag=; b=bG0RAYiPWF6o+lhBECdgMR5tfHOZf7RM+1wz8Ew/6P0aWuZQaXhHY4rceGg6kqCdTr7ABt499wi0lwzCB6qOhr5kuUoCrfsziZuBi9s7BoBmS133AWG8SZ8+P8SGVseIdamc/4/SHQ3TAOpe40/b2ViUc0Noh6AuM5Q8Si3Bim0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=ktkhai@virtuozzo.com; Received: from [172.16.25.169] (185.231.240.5) by DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1038.21; Thu, 9 Aug 2018 09:22:02 +0000 Subject: Re: [PATCH RFC v2 02/10] mm: Make shrink_slab() lockless To: Michal Hocko Cc: akpm@linux-foundation.org, gregkh@linuxfoundation.org, rafael@kernel.org, viro@zeniv.linux.org.uk, darrick.wong@oracle.com, paulmck@linux.vnet.ibm.com, josh@joshtriplett.org, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, hughd@google.com, shuah@kernel.org, robh@kernel.org, ulf.hansson@linaro.org, aspriel@gmail.com, vivek.gautam@codeaurora.org, robin.murphy@arm.com, joe@perches.com, heikki.krogerus@linux.intel.com, sfr@canb.auug.org.au, vdavydov.dev@gmail.com, chris@chris-wilson.co.uk, penguin-kernel@I-love.SAKURA.ne.jp, aryabinin@virtuozzo.com, willy@infradead.org, ying.huang@intel.com, shakeelb@google.com, jbacik@fb.com, mingo@kernel.org, mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <153365347929.19074.12509495712735843805.stgit@localhost.localdomain> <153365626605.19074.16202958374930777592.stgit@localhost.localdomain> <591d2063-0511-103d-bef6-dd35f55afe32@virtuozzo.com> <4ceb948c-7ce7-0db3-17d8-82ef1e6e47cc@virtuozzo.com> <20180809071418.GA24884@dhcp22.suse.cz> From: Kirill Tkhai Message-ID: Date: Thu, 9 Aug 2018 12:21:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180809071418.GA24884@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1PR0202CA0001.eurprd02.prod.outlook.com (2603:10a6:803:14::14) To DB6PR0801MB2021.eurprd08.prod.outlook.com (2603:10a6:4:76::14) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: baefd80d-9928-46bf-5cb6-08d5fdd992b6 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB2021; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;3:xGb2P91jnCywa9rPJf2v5eeNwx/3wrXQGS9UAHulbgR0PZXjPi2VdzV3/EfrHxx8b8wQo/d9lmYYpQf8YbEz9Od4XJvj20iSjdGIPqREo3KspB9wCNPV+xdv7OD3uUhdokZNk+437p+/bV1dKpBYLXN1tyUSif6+j2vYmcNTHxlzQRG0GC4UXM2yfNmrgSs86kgiZQhLkyP2VLQa0aovQvqo4ob1JEX1LyIidvKHOOwQBqfu+Kd6Y0dD5v0CJ67c;25:NmFyueSl8fjclux1KLknlA7WqxuvPE9DVyxL+RZksq2buYqA4DQGy/OjxMttGW+CNHssJETyK3JXiw/rcM3sMcezik8DGfjR1xZJqpCn5b8tvvLOmxQx3jgs5RXDfl0K/qMchyJrQ+fs0zPlQCZPlVHDEX7SYIoVafrj49NaXRe2DBJQGoSNC1NXEg8zX0kbaDHHfwhmFZzNfLLSstkbdGg3xaoYixoaFDTQvqYZ9Vue7xjkOoW+g4MQ1xovdfmVfk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8UWxdMx8gko1U4dnXPfaBi7Yxwiq1UxdngIN6i0mGlUMxDwHc0qu2Ztbo51eJqSSdyscviyAAknAWrdTGA37up2UFuep/0w7HSkYWsxNi1g8w== 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)(8121501046)(5005006)(3231311)(944501410)(52105095)(10201501046)(3002001)(93006095)(93001095)(149027)(150027)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016);SRVR:DB6PR0801MB2021;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0801MB2021; X-Forefront-PRVS: 0759F7A50A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6049001)(39840400004)(366004)(346002)(136003)(376002)(396003)(189003)(199004)(31686004)(956004)(7736002)(305945005)(7416002)(230700001)(7406005)(65826007)(106356001)(105586002)(6116002)(5660300001)(3846002)(93886005)(25786009)(50466002)(2486003)(23676004)(52146003)(81156014)(8676002)(53546011)(2906002)(53936002)(68736007)(229853002)(76176011)(476003)(2616005)(81166006)(446003)(36756003)(11346002)(386003)(486006)(6666003)(52116002)(6916009)(47776003)(186003)(16526019)(478600001)(97736004)(4326008)(26005)(39060400002)(217873002)(86362001)(31696002)(77096007)(6246003)(65956001)(66066001)(316002)(65806001)(8936002)(58126008)(16576012)(14444005)(6486002)(64126003);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0801MB2021;H:[172.16.25.169];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?MTtEQjZQUjA4MDFNQjIwMjE7MjM6a0daNnRBQU85UHNTRU9ZejVDdGRUM2gx?= =?utf-8?B?M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btv6z2WwJ1ebXXdsuPqPMDjba5AgsfMvlEGAB+bIagVl5+VbvEFeciSGwuk9zi2LiNj1Q9NL6Dqk21B3ldvxY8YIMsrJXTQ8k7etvrVtX6iAS4sA==;5:7Nom+6VsB1nXV6dmBzUHEJqbiZ8X+DhLJDR0eHoKHDLRZCQHjOi/TmyGuZOK2jWr1FNNoABfsrQVb8A9aXOxbQxQeJjuL7x1EabqW52O6zKGd/0geRITi85Au0LQ1ul9obE3YU0dUyJGlqAV6ZF2u+RE9jgLbXvg+masdhsL2kg=;7:2ETPLgoJq7TsXsHTSZrhoCaAdia+DyQn9apBn7O+IN3c8ND5LSx/IuiSlL4hxscx+jn7unZQtvIzR+pMbDUqSRwUL96wTqXAxilHNlpVSPzCAhR1abx7Qyb6qNJgDiPNezdzfDk15nJRjatu5aD6PfQpGxdVGNFAHNf3aIoUfC1JyX11Nbi8Jp8fW6XEP0wnjtNTnr8oFQVX7CyCi0QImwE+Rvj7RNybfgvC5U+ar6rbkSuH3OSmmCoJh2jus4Az SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0801MB2021;20:+6g5fYAtg8acXngz+rgxGFO3EzdkI2NVrgX9+v7o9taHTOGWWc7AxmuVR2WNMANNUyK9o7rPg3z1YoeFhRTPAL8y9nioySSMq7pZMnF46DUkFRcLxbjSJVTMBQDKzkdRJFyAhnytF0uQWSJZKPzQUNLkaS69jH9qTV2u1/+03gM= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Aug 2018 09:22:02.0667 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: baefd80d-9928-46bf-5cb6-08d5fdd992b6 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB2021 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09.08.2018 10:14, Michal Hocko wrote: > On Wed 08-08-18 16:20:54, Kirill Tkhai wrote: >> [Added two more places needed srcu_dereference(). All ->shrinker_map >> dereferences must be under SRCU, and this v2 adds missed in previous] >> >> The patch makes shrinker list and shrinker_idr SRCU-safe >> for readers. This requires synchronize_srcu() on finalize >> stage unregistering stage, which waits till all parallel >> shrink_slab() are finished >> >> Note, that patch removes rwsem_is_contended() checks from >> the code, and this does not result in delays during >> registration, since there is no waiting at all. Unregistration >> case may be optimized by splitting unregister_shrinker() >> in tho stages, and this is made in next patches. >> >> Also, keep in mind, that in case of SRCU is not allowed >> to make unconditional (which is done in previous patch), >> it is possible to use percpu_rw_semaphore instead of it. >> percpu_down_read() will be used in shrink_slab_memcg() >> and in shrink_slab(), and consecutive calls >> >> percpu_down_write(percpu_rwsem); >> percpu_up_write(percpu_rwsem); >> >> will be used instead of synchronize_srcu(). > > An obvious question. Why didn't you go that way? What are pros/cons of > both approaches? 1)After percpu_rw_semaphore is introduced, shrink_slab() will be not able to do successful percpu_down_read_trylock() for longer time in comparison to current behavior: [cpu0] [cpu1] {un,}register_shrinker(); shrink_slab() percpu_down_write(); percpu_down_read_trylock() -> fail synchronize_rcu(); -> in some periods very slow on big SMP ... shrink_slab() percpu_down_read_trylock() -> fail Also, register_shrinker() and unregister_shrinker() will become slower for the same reason. Unlike unregister_shrinker(); register_shrinker() can't be made asynchronous/delayed, so simple mount() performance will be worse. It's possible, these both can be solved by using both percpu_rw_semaphore and rw_semaphore. shrink_slab() may fall back to rw_semaphore in case of percpu_rw_semaphore can't be blocked: shrink_slab() { bool percpu = true; if (!percpu_down_read_try_lock()) { if(!down_read_trylock()) return 0; percpu = false; } shrinker = idr_find(); ... if (percpu) percpu_up_read(); else up_read(); } register_shrinker() { down_write(); idr_alloc(); up_write(); } unregister_shrinker() { percpu_down_write(); down_write(); idr_remove(); up_write(); percpu_up_write(); } But a)On big machine this may turn in always down_read_trylock() like we have now; b)I'm not sure, unlocked idr_find() is safe in parallel with idr_alloc(), maybe, there is needed something else around it (I just haven't investigated this). All the above are cons. Pros are not enabling SRCU. 2)SRCU. Pros are there are no the above problems; we will have completely unlocked and scalable shrink_slab(). We will also have a possibility to avoid unregistering delays, like I did for superblock shrinker. There will be full scalability. Cons is enabling SRCU. Kirill