Messages in this thread | | | Date | Fri, 07 May 2010 09:52:33 -0700 | From | Darren Hart <> | Subject | Re: [PATCH 4/4] futex: Add FUTEX_LOCK with optional adaptive spinning |
| |
Thomas Gleixner wrote: > On Wed, 5 May 2010, Darren Hart wrote: > >> Add a non-pi TID value based futex locking mechanism. This enables the >> use of adaptive spinning which was problematic with the basic FUTEX_WAIT >> operation. > > You still do way too much work in that spin code with way too much > code lines. > > Can you try the following (completely uncompiled/untested) patch ? > > Thanks, > > tglx > Subject: futex-simplify.patch > From: Thomas Gleixner <tglx@linutronix.de> > Date: Fri, 07 May 2010 17:56:38 +0200 > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de> > --- > kernel/futex.c | 42 ++++++++++++------------------------ > kernel/sched.c | 66 --------------------------------------------------------- > 2 files changed, 14 insertions(+), 94 deletions(-) >
> + if (to && !to->task) { > + ret = -ETIMEOUT; > break;
I had hoped to be able to do it like this too. Unfortunately, we can't arm the timer until after we set TASK_INTERRUPTIBLE, and we don't do that until after we give up on spinning.
> - > - if (timeout) { > - now = ktime_get(); > - if (timeout->tv64 < now.tv64) > - break; > }
This bit clearly needs work. Either via some interpolated time calculation using something like jiffies, or via another timer that sets a bit we can check in here.
-- Darren Hart IBM Linux Technology Center Real-Time Linux Team
| |