diff options
author | Andrew Morton <akpm@osdl.org> | 2006-10-06 03:43:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-06 11:53:39 -0400 |
commit | d69a892268c66c13fcb445a8274baa9d7befb7b5 (patch) | |
tree | bf8a7612f8dd0d759fae7b564c22bdd89d77b355 /include | |
parent | 4899b8b16b302299cc91289f7b5bac295e9ab387 (diff) |
[PATCH] Fix WARN_ON / WARN_ON_ONCE regression
Tim and Ananiev report that the recent WARN_ON_ONCE changes cause increased
cache misses with the tbench workload. Apparently due to the access to the
newly-added static variable.
Rearrange the code so that we don't touch that variable unless the warning is
going to trigger.
Also rework the logic so that the static variable starts out at zero, so we
can move it into bss.
It would seem logical to mark the static variable as __read_mostly too. But
it would be wrong, because that would put it back into the vmlinux image, and
the kernel will never read from this variable in normal operation anyway.
Unless the compiler or hardware go and do some prefetching on us?
For some reason this patch shrinks softirq.o text by 40 bytes.
Cc: Tim Chen <tim.c.chen@intel.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Ananiev, Leonid I" <leonid.i.ananiev@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/bug.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h index a5250895155e..1d9573cf4a0b 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h | |||
@@ -41,14 +41,14 @@ | |||
41 | #endif | 41 | #endif |
42 | #endif | 42 | #endif |
43 | 43 | ||
44 | #define WARN_ON_ONCE(condition) ({ \ | 44 | #define WARN_ON_ONCE(condition) ({ \ |
45 | static int __warn_once = 1; \ | 45 | static int __warned; \ |
46 | typeof(condition) __ret_warn_once = (condition);\ | 46 | typeof(condition) __ret_warn_once = (condition); \ |
47 | \ | 47 | \ |
48 | if (likely(__warn_once)) \ | 48 | if (unlikely(__ret_warn_once)) \ |
49 | if (WARN_ON(__ret_warn_once)) \ | 49 | if (WARN_ON(!__warned)) \ |
50 | __warn_once = 0; \ | 50 | __warned = 1; \ |
51 | unlikely(__ret_warn_once); \ | 51 | unlikely(__ret_warn_once); \ |
52 | }) | 52 | }) |
53 | 53 | ||
54 | #ifdef CONFIG_SMP | 54 | #ifdef CONFIG_SMP |