[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180809071418.GA24884@dhcp22.suse.cz>
Date: Thu, 9 Aug 2018 09:14:18 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Kirill Tkhai <ktkhai@...tuozzo.com>
Cc: akpm@...ux-foundation.org, gregkh@...uxfoundation.org,
rafael@...nel.org, viro@...iv.linux.org.uk,
darrick.wong@...cle.com, paulmck@...ux.vnet.ibm.com,
josh@...htriplett.org, rostedt@...dmis.org,
mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
hughd@...gle.com, shuah@...nel.org, robh@...nel.org,
ulf.hansson@...aro.org, aspriel@...il.com,
vivek.gautam@...eaurora.org, robin.murphy@....com, joe@...ches.com,
heikki.krogerus@...ux.intel.com, sfr@...b.auug.org.au,
vdavydov.dev@...il.com, chris@...is-wilson.co.uk,
penguin-kernel@...ove.SAKURA.ne.jp, aryabinin@...tuozzo.com,
willy@...radead.org, ying.huang@...el.com, shakeelb@...gle.com,
jbacik@...com, mingo@...nel.org, mhiramat@...nel.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org
Subject: Re: [PATCH RFC v2 02/10] mm: Make shrink_slab() lockless
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
Powered by blists - more mailing lists