On 10/12, Andrew Morton wrote: > > On Wed, 11 Oct 2017 20:54:32 -0400 Rik van Riel <[email protected]> wrote: > > > Documenting the locking on all the existing code, plus the > > new code, seems a little out of scope of an Outreachy > > internship... > > I'm not referring to all the existing code! Just this new > pid_namespace.idr's locking. If it was protected by > spin_lock_irq(&pidmap_lock) everywhere then an explanation wouldn't be > needed. But we have this oddball site where pidmap_lock isn't taken > but it uses rcu_read_lock() which is surprising to say the least. > Readers could be forgiven for thinking that is a bug.
Actually this all looks simple, or I missed something... pid_namespace.idr is protected by pidmap_lock, it is always modified with this lock held. idr_find/idr_find_ext/etc can be called under rcu_read_lock() simply because idr/radix_tree is rcu-safe and this is already documented in idr.h, say, the comment above idr_find() says * This function can be called under rcu_read_lock(), given that the leaf * pointers lifetimes are correctly managed. Oleg.

