lkml.org 
[lkml]   [2015]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] futex: don't spin waiting for PF_EXITING -> PF_EXITPIDONE transition
On Mon, Feb 16, 2015 at 09:13:36PM +0100, Oleg Nesterov wrote:

> diff --git a/kernel/futex.c b/kernel/futex.c
> index b101381..c1104a8 100644
> +++ b/kernel/futex.c
> @@ -716,11 +716,13 @@ void exit_pi_state_list(struct task_struct *curr)
>
> if (!futex_cmpxchg_enabled)
> return;
> +
> /*
> + * attach_to_pi_owner() can no longer add the new entry. But
> + * we have to be careful versus waiters unqueueing themselves.
> */
> + curr->flags |= PF_EXITPIDONE;
> +
> raw_spin_lock_irq(&curr->pi_lock);
> while (!list_empty(head)) {
>

Should we not set PF_EXITPIDONE _inside_ the pi_lock? To properly
serialize against the below check?

> @@ -905,24 +907,12 @@ static int attach_to_pi_owner(u32 uval, union futex_key *key,
> return -EPERM;
> }
>
> raw_spin_lock_irq(&p->pi_lock);
> + if (unlikely(p->flags & PF_EXITPIDONE)) {
> + /* exit_pi_state_list() was already called */
> raw_spin_unlock_irq(&p->pi_lock);
> put_task_struct(p);
> + return -ESRCH;
> }
>
> /*




\
 
 \ /
  Last update: 2015-02-27 11:01    [W:0.055 / U:0.564 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site