-
The filesystem freezer uses percpu-rwsem in a way that is effectively
write_non_owner() and achieves this with a few horrible hacks that
rely on the rwsem (!percpu) implementation.When PREEMPT_RT replaces the rwsem implementation with a PI aware
variant this comes apart.Remove the embedded rwsem and implement it using a waitqueue and an
atomic_t.- make readers_block an atomic, and use it, with the waitqueue
for a blocking test-and-set write-side.- have the read-side wait for the 'lock' state to clear.
Have the waiters use FIFO queueing and mark them (reader/writer) with
a new WQ_FLAG. Use a custom wake_function to wake either a single
writer or all readers until a writer.Signed-off-by: Peter Zijlstra (Intel)
Signed-off-by: Ingo Molnar
Reviewed-by: Davidlohr Bueso
Acked-by: Will Deacon
Acked-by: Waiman Long
Tested-by: Juri Lelli
Link: https://lkml.kernel.org/r/20200204092403.GB14879@hirez.programming.kicks-ass.net