diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-05-08 03:27:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-08 14:15:06 -0400 |
commit | 329c8d84ca1946c037d9859dc251b56d8b1b4630 (patch) | |
tree | 05cfd2124dd6066eb6c2e769be99f6860ffb7501 | |
parent | f75d222b836f7febfab0954c7612b23059d748cb (diff) |
time: SMP friendly alignment of struct clocksource
struct clocksource is a critical data structure.
Most of its fields are read only, some of them are heavily modified at each
timer interrupt.
It makes sense to separate those fields and make sure they all share one
cache line, or at least the minimum for machines with small cache lines.
[akpm@linux-foundation.org: build fix]
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Acked-by: John Stultz <johnstul@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/clocksource.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index daa4940cc0f1..2665ca04cf8f 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/timex.h> | 12 | #include <linux/timex.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/list.h> | 14 | #include <linux/list.h> |
15 | #include <linux/cache.h> | ||
15 | #include <linux/timer.h> | 16 | #include <linux/timer.h> |
16 | #include <asm/div64.h> | 17 | #include <asm/div64.h> |
17 | #include <asm/io.h> | 18 | #include <asm/io.h> |
@@ -52,6 +53,9 @@ struct clocksource; | |||
52 | * @xtime_interval: Used internally by timekeeping core, please ignore. | 53 | * @xtime_interval: Used internally by timekeeping core, please ignore. |
53 | */ | 54 | */ |
54 | struct clocksource { | 55 | struct clocksource { |
56 | /* | ||
57 | * First part of structure is read mostly | ||
58 | */ | ||
55 | char *name; | 59 | char *name; |
56 | struct list_head list; | 60 | struct list_head list; |
57 | int rating; | 61 | int rating; |
@@ -63,8 +67,15 @@ struct clocksource { | |||
63 | cycle_t (*vread)(void); | 67 | cycle_t (*vread)(void); |
64 | 68 | ||
65 | /* timekeeping specific data, ignore */ | 69 | /* timekeeping specific data, ignore */ |
66 | cycle_t cycle_last, cycle_interval; | 70 | cycle_t cycle_interval; |
67 | u64 xtime_nsec, xtime_interval; | 71 | u64 xtime_interval; |
72 | /* | ||
73 | * Second part is written at each timer interrupt | ||
74 | * Keep it in a different cache line to dirty no | ||
75 | * more than one cache line. | ||
76 | */ | ||
77 | cycle_t cycle_last ____cacheline_aligned_in_smp; | ||
78 | u64 xtime_nsec; | ||
68 | s64 error; | 79 | s64 error; |
69 | 80 | ||
70 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG | 81 | #ifdef CONFIG_CLOCKSOURCE_WATCHDOG |