Re: [PATCH v2 2/3] locking/percpu-rwsem: Rework writer block/wake to not use wait-queues

From: Davidlohr Bueso
Date: Mon Dec 05 2016 - 12:37:27 EST


On Mon, 05 Dec 2016, Oleg Nesterov wrote:

Yes. But percpu_down_write() should not be used after exit_notify(), so we
can rely on rcu_read_lock(), release_task()->call_rcu(delayed_put_task_struct)
can't be called until an exiting task passes exit_notify().

But then we probably need WARN_ON(current->exit_state) in percpu_down_write().

Hmm, my immediate thought would have been doing a PF_EXITING check, but of course
this enlarges the window of the warn being triggered, yet maintains what you are
saying in that percpu_down_write should not be used after do_exit/exit_notify.
Furthermore, reading the comment in task_rcu_dereference, I get your point and
we can loose the reference to the task, iow busted rcu read cr.


And personally I think this change should add the new helpers, they can have
more users. Something like

struct xxx {

What do you think of s/xxx/rcuwait?

Thanks,
Davidlohr