[PATCH v2] proc: Allow pid_revalidate() during LOOKUP_RCU
Matthew Wilcox
willy at infradead.org
Sun Dec 13 16:32:34 UTC 2020
On Sun, Dec 13, 2020 at 08:30:40AM -0600, Eric W. Biederman wrote:
> Stephen Brennan <stephen.s.brennan at oracle.com> writes:
>
> > The pid_revalidate() function requires dropping from RCU into REF lookup
> > mode. When many threads are resolving paths within /proc in parallel,
> > this can result in heavy spinlock contention as each thread tries to
> > grab a reference to the /proc dentry lock (and drop it shortly
> > thereafter).
>
> I am feeling dense at the moment. Which lock specifically are you
> referring to? The only locks I can thinking of are sleeping locks,
> not spinlocks.
Stephen may have a better answer than this, but our mutex implementation
spins if the owner is still running, so he may have misspoken slightly.
He's testing on a giant system with hundreds of CPUs, so a mutex is
going to behave like a spinlock for him.
> Why do we need to test flags here at all?
> Why can't the code simply take an rcu_read_lock unconditionally and just
> pass flags into do_pid_update_inode?
Hah! I was thinking about that possibility this morning, and I was
going to ask you that question.
More information about the Linux-security-module-archive
mailing list