On Fri, May 03, 2019 at 05:37:48PM +0200, Oleg Nesterov wrote: > (And if we change this code to use wait_event(xchg(readers_block) == 0) we > can remove rw_sem altogether). That patch you just saw and didn't look at did just that. > The main problem is that this is sub-optimal. We can have a lot of readers > sleeping in __down_read() when percpu_down_write() succeeds, then after > percpu_down_write_non_owner() does up_write() they all will be woken just > to hang in readers_block(). Plus the new readers will need to pass the > lock-check-unlock-schedule path. Yes, that's gone. Still, write side locking on percpu-rwsem _should_ be relatively rare and is certainly not a fast path. > Peter, just in case... I see another patch from you but I need to run away > till Monday. n/p, enjoy the weekend!