Re: [RFC PATCH 1/1] fs/namespace.c: use spinlock instead of busy loop

From: Peter Zijlstra
Date: Wed Jun 17 2020 - 07:27:24 EST


On Wed, Jun 17, 2020 at 12:46:58PM +0206, John Ogness wrote:
> The MNT_WRITE_HOLD flag is used to manually implement a per-cpu
> optimized rwsem using busy waiting. This implementation is a problem
> on PREEMPT_RT because write_seqlock() on @mount_lock (i.e. taking a
> spinlock) does not disable preemption. This allows a writer to
> preempt a task that has set MNT_WRITE_HOLD and thus that writer will
> live lock in __mnt_want_write() due to busy looping with preemption
> disabled.
>

Why can't you use a regular percpu-rwsem for this?