Re: [PATCH v2] mm, shrinker: make shrinker_list lockless
From: Tetsuo Handa
Date: Thu Nov 09 2017 - 16:46:28 EST
Shakeel Butt wrote:
> > If you can accept serialized register_shrinker()/unregister_shrinker(),
> > I think that something like shown below can do it.
>
> If we assume that we will never do register_shrinker and
> unregister_shrinker on the same object in parallel then do we still
> need to do msleep & synchronize_rcu() within mutex?
Doing register_shrinker() and unregister_shrinker() on the same object
in parallel is wrong. This mutex is to ensure that we do not need to
worry about ->list.next field. synchronize_rcu() should not be slow.
If you want to avoid msleep() with mutex held, you can also apply
> > If you want parallel register_shrinker()/unregister_shrinker(), something like
> > shown below on top of shown above will do it.
change.