Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1711355imm; Thu, 9 Aug 2018 00:15:26 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxNclsHLUCXVIKCi8xYdPQSQr8RGSpEoQlkLsL8Q+849Uos1Bt7njmLOgnCvhKSOu42yuw/ X-Received: by 2002:a17:902:820e:: with SMTP id x14-v6mr972683pln.218.1533798926825; Thu, 09 Aug 2018 00:15:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533798926; cv=none; d=google.com; s=arc-20160816; b=WRBiX4RB6NM0nEiQEy5fCdDULZlJWa3JlKqyA+6pd+1Xibvwh9BlFQ8AIKyFI2y5Ju CD/pXp2/RMTo0WkjLPmL5t6MFgRi2pIoRWEp4yStxOADJwB3UMiXlgPr2hjeBiqKg/DP rYSbeNTm6uPMkX4K8qKFcu4KcOUIN4PnQzjQMTkw2zUEhEzhaRhTP2ij0rk+vvpMLgWg po2qpIO5PKUt43qRg6/l9+dMjpX4Zg0npxTwB1+eFvmO7rGerCX74+Ule8+t6T5LWXOs rnEVjWVv2Z3UYXxFnl6sN09llPHnYcHu4l1Z8URcUtDTaDVyhE8IQgDvFm3gYThAQBhg V8NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=3/t8viOuNxSSKmlyyWNaHuVMTJwuqfpcJOjjMUIyu5o=; b=F69BTNsHLbSCFd0ctKVLXq9tKCxCAcnxxfZzUrRGCruBUPvLARrpoNQ0uKorSyujJp CU465BZsY7mobdxiFN3rH+OWG0T7jisWZ2ydiPNL34pvqYHAHAt9Bqdxajzw9BS7PAMt VAyWRC1ELDFC1RZXCMaEN0dral3SR/Kg6O1vGDwbgAq+mVZrtiaixdSF76IDMi6z1YWW YlRZj3KNYpt+1piCNGgBGUzIHy5a11NRS+YZ866vdXj6qfOtjvslenaLHPpb0GQzQZzX MFo+fk3G0zzSz6MHjYHyqRQZ7cQbzAubGTN9myobmAD7uxm74nBTxJIzECRFS3JkiAi2 zUlw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 37-v6si6399868pgy.118.2018.08.09.00.15.12; Thu, 09 Aug 2018 00:15:26 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728596AbeHIJhw (ORCPT + 99 others); Thu, 9 Aug 2018 05:37:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:44262 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728056AbeHIJhw (ORCPT ); Thu, 9 Aug 2018 05:37:52 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 87CACAEC0; Thu, 9 Aug 2018 07:14:21 +0000 (UTC) Date: Thu, 9 Aug 2018 09:14:18 +0200 From: Michal Hocko To: Kirill Tkhai 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 Subject: Re: [PATCH RFC v2 02/10] mm: Make shrink_slab() lockless Message-ID: <20180809071418.GA24884@dhcp22.suse.cz> 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4ceb948c-7ce7-0db3-17d8-82ef1e6e47cc@virtuozzo.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -- Michal Hocko SUSE Labs