Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Paul E. McKenney
On Fri, Jun 30, 2017 at 01:02:48PM -0700, Paul E. McKenney wrote: > On Fri, Jun 30, 2017 at 09:21:23PM +0200, Oleg Nesterov wrote: > > On 06/30, Paul E. McKenney wrote: > > > > > > On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > > > > > > > > I do not think the overhead will be not

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Paul E. McKenney
On Fri, Jun 30, 2017 at 03:50:33PM -0400, Alan Stern wrote: > On Fri, 30 Jun 2017, Oleg Nesterov wrote: > > > On 06/30, Paul E. McKenney wrote: > > > > > > On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > > > > > > > > I do not think the overhead will be noticeable in this particul

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Paul E. McKenney
On Fri, Jun 30, 2017 at 09:21:23PM +0200, Oleg Nesterov wrote: > On 06/30, Paul E. McKenney wrote: > > > > On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > > > > > > I do not think the overhead will be noticeable in this particular case. > > > > > > But I am not sure I understand wh

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Alan Stern
On Fri, 30 Jun 2017, Oleg Nesterov wrote: > On 06/30, Paul E. McKenney wrote: > > > > On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > > > > > > I do not think the overhead will be noticeable in this particular case. > > > > > > But I am not sure I understand why do we want to unlo

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Oleg Nesterov
On 06/30, Paul E. McKenney wrote: > > On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > > > > I do not think the overhead will be noticeable in this particular case. > > > > But I am not sure I understand why do we want to unlock_wait. Yes I agree,

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Paul E. McKenney
On Fri, Jun 30, 2017 at 09:16:07AM -0700, Paul E. McKenney wrote: > On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > > On 06/30, Paul E. McKenney wrote: > > > > > > > > + raw_spin_lock_irq(&task->pi_lock); > > > > > + raw_spin_unlock_irq(&task->pi_lock); > >

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Paul E. McKenney
On Fri, Jun 30, 2017 at 05:20:10PM +0200, Oleg Nesterov wrote: > On 06/30, Paul E. McKenney wrote: > > > > > > + raw_spin_lock_irq(&task->pi_lock); > > > > + raw_spin_unlock_irq(&task->pi_lock); > > > > I agree that the spin_unlock_wait() implementations would avoid the

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Oleg Nesterov
On 06/30, Paul E. McKenney wrote: > > > > + raw_spin_lock_irq(&task->pi_lock); > > > + raw_spin_unlock_irq(&task->pi_lock); > > I agree that the spin_unlock_wait() implementations would avoid the > deadlock with an acquisition from an interrupt handler, while also > avoiding the nee

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Paul E. McKenney
On Fri, Jun 30, 2017 at 01:04:45PM +0200, Oleg Nesterov wrote: > On 06/29, Paul E. McKenney wrote: > > > > --- a/kernel/task_work.c > > +++ b/kernel/task_work.c > > @@ -109,7 +109,8 @@ void task_work_run(void) > > * the first entry == work, cmpxchg(task_works) should > > *

Re: [PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-30 Thread Oleg Nesterov
On 06/29, Paul E. McKenney wrote: > > --- a/kernel/task_work.c > +++ b/kernel/task_work.c > @@ -109,7 +109,8 @@ void task_work_run(void) >* the first entry == work, cmpxchg(task_works) should >* fail, but it can play with *work and other entries. >*/

[PATCH RFC 02/26] task_work: Replace spin_unlock_wait() with lock/unlock pair

2017-06-29 Thread Paul E. McKenney
There is no agreed-upon definition of spin_unlock_wait()'s semantics, and it appears that all callers could do just as well with a lock/unlock pair. This commit therefore replaces the spin_unlock_wait() call in task_work_run() with spin_lock() followed immediately by spin_unlock(). This should be