Re: Spinlocks: Factor our GENERIC_LOCKBREAK in order to avoid spinwith irqs disable

From: Christoph Lameter
Date: Fri May 09 2008 - 12:28:31 EST


On Fri, 9 May 2008, Ingo Molnar wrote:

> hm, there was some lockdep complication in this area. I guess we could
> use the 'nice' variants too if their irq-enabling/disabling was properly
> lockdep annotated and tracked by the irqflags machinery?

I thought that we already fall back to the functions that spin while
having interrupts disabled if lockdep is on?

One issue: The BREAKLOCK value needs to be 1 in the fallback case
otherwise we needlessly run atomic ops.

---
kernel/spinlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/kernel/spinlock.c
===================================================================
--- linux-2.6.orig/kernel/spinlock.c 2008-05-07 16:00:06.000000000 -0700
+++ linux-2.6/kernel/spinlock.c 2008-05-07 16:00:29.000000000 -0700
@@ -218,7 +218,7 @@ do { \

#else

-#define BREAKLOCK(lock) 0
+#define BREAKLOCK(lock) 1
#define BREAKLOCK_ENABLE(lock) do { } while (0)
#define BREAKLOCK_DISABLE(lock) do { } while (0)

--
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/