Re: [PATCH 4/4] futex: Add FUTEX_LOCK with optional adaptive spinning
From: Darren Hart
Date: Fri May 07 2010 - 12:52:51 EST
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@xxxxxxxxxxxxx>
Date: Fri, 07 May 2010 17:56:38 +0200
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/