Prev: [PATCH 0/4][RT] futex: fix tasks blocking on two rt_mutex locks
Next: futex: convert hash_bucket locks to raw_spinlock_t
From: Darren Hart on 9 Jul 2010 19:00 Apologies, mangled a rebase and this patch had bits of 4/4 in it. Corrected below: From f40b8e684df6ed2b1ba9167cad3922ab43f4a717 Mon Sep 17 00:00:00 2001 From: Darren Hart <dvhltc(a)us.ibm.com> Date: Fri, 9 Jul 2010 17:07:10 -0400 Subject: [PATCH 3/4 V2] futex: free_pi_state outside of hb->lock sections free_pi_state() calls kfree() and might sleep. To prepare for raw hb->locks, get the calls to free_pi_state() out of the hb->lock() sections. Signed-off-by: Darren Hart <dvhltc(a)us.ibm.com> Cc: Thomas Gleixner <tglx(a)linutronix.de> Cc: Peter Zijlstra <peterz(a)infradead.org> Cc: Ingo Molnar <mingo(a)elte.hu> Cc: Eric Dumazet <eric.dumazet(a)gmail.com> Cc: John Kacur <jkacur(a)redhat.com> Cc: Steven Rostedt <rostedt(a)goodmis.org> Cc: Mike Galbraith <efault(a)gmx.de> --- kernel/futex.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/futex.c b/kernel/futex.c index a6cec32..2cd58a2 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -1339,7 +1339,6 @@ retry_private: } else if (ret) { /* -EDEADLK */ this->pi_state = NULL; - free_pi_state(pi_state); goto out_unlock; } } @@ -1483,16 +1482,19 @@ retry: */ static void unqueue_me_pi(struct futex_q *q) { + struct futex_pi_state *pi_state = NULL; + WARN_ON(plist_node_empty(&q->list)); plist_del(&q->list, &q->list.plist); BUG_ON(!q->pi_state); - free_pi_state(q->pi_state); + pi_state = q->pi_state; q->pi_state = NULL; spin_unlock(q->lock_ptr); - drop_futex_key_refs(&q->key); + + free_pi_state(pi_state); } /* -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Darren Hart on 10 Jul 2010 10:50 On 07/09/2010 05:32 PM, Steven Rostedt wrote: > On Fri, 2010-07-09 at 15:55 -0700, Darren Hart wrote: >> Apologies, mangled a rebase and this patch had bits of 4/4 in it. >> Corrected below: >> >> >> > From f40b8e684df6ed2b1ba9167cad3922ab43f4a717 Mon Sep 17 00:00:00 2001 >> From: Darren Hart<dvhltc(a)us.ibm.com> >> Date: Fri, 9 Jul 2010 17:07:10 -0400 >> Subject: [PATCH 3/4 V2] futex: free_pi_state outside of hb->lock sections >> >> free_pi_state() calls kfree() and might sleep. To prepare for raw hb->locks, >> get the calls to free_pi_state() out of the hb->lock() sections. >> >> Signed-off-by: Darren Hart<dvhltc(a)us.ibm.com> >> Cc: Thomas Gleixner<tglx(a)linutronix.de> >> Cc: Peter Zijlstra<peterz(a)infradead.org> >> Cc: Ingo Molnar<mingo(a)elte.hu> >> Cc: Eric Dumazet<eric.dumazet(a)gmail.com> >> Cc: John Kacur<jkacur(a)redhat.com> >> Cc: Steven Rostedt<rostedt(a)goodmis.org> >> Cc: Mike Galbraith<efault(a)gmx.de> >> --- >> kernel/futex.c | 8 +++++--- >> 1 files changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/kernel/futex.c b/kernel/futex.c >> index a6cec32..2cd58a2 100644 >> --- a/kernel/futex.c >> +++ b/kernel/futex.c >> @@ -1339,7 +1339,6 @@ retry_private: > > This is why I always add a space before labels. I have no idea what > function this was in. > >> } else if (ret) { >> /* -EDEADLK */ >> this->pi_state = NULL; >> - free_pi_state(pi_state); > > Where do we free the pi state here? Near the end after goto out_unlock which falls through to the out: label. In this case I didn't move it, it just wasn't necessary. out: if (pi_state != NULL) free_pi_state(pi_state); -- Darren Hart IBM Linux Technology Center Real-Time Linux Team -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Thomas Gleixner on 12 Jul 2010 06:40 On Fri, 9 Jul 2010, Darren Hart wrote: > free_pi_state() calls kfree() and might sleep. To prepare for raw hb->locks, > get the calls to free_pi_state() out of the hb->lock() sections. > > Signed-off-by: Darren Hart <dvhltc(a)us.ibm.com> > Cc: Thomas Gleixner <tglx(a)linutronix.de> > Cc: Peter Zijlstra <peterz(a)infradead.org> > Cc: Ingo Molnar <mingo(a)elte.hu> > Cc: Eric Dumazet <eric.dumazet(a)gmail.com> > Cc: John Kacur <jkacur(a)redhat.com> > Cc: Steven Rostedt <rostedt(a)goodmis.org> > Cc: Mike Galbraith <efault(a)gmx.de> > --- > kernel/futex.c | 14 ++++++++------ > 1 files changed, 8 insertions(+), 6 deletions(-) > > diff --git a/kernel/futex.c b/kernel/futex.c > index a6cec32..b217972 100644 > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@ -114,7 +114,7 @@ struct futex_q { > struct plist_node list; > > struct task_struct *task; > - spinlock_t *lock_ptr; > + raw_spinlock_t *lock_ptr; How is this related to the changelog ? Thanks, tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
From: Steven Rostedt on 12 Jul 2010 06:50
On Mon, 2010-07-12 at 12:35 +0200, Thomas Gleixner wrote: > On Fri, 9 Jul 2010, Darren Hart wrote: > > > free_pi_state() calls kfree() and might sleep. To prepare for raw hb->locks, > > get the calls to free_pi_state() out of the hb->lock() sections. > > > > Signed-off-by: Darren Hart <dvhltc(a)us.ibm.com> > > struct task_struct *task; > > - spinlock_t *lock_ptr; > > + raw_spinlock_t *lock_ptr; > > How is this related to the changelog ? Read the reply to himself (V2) ;-) -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ |