From: Eric Dumazet 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. Signed-off-by: Eric Dumazet Acked-by: John Stultz Signed-off-by: Andrew Morton --- include/linux/clocksource.h | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff -puN include/linux/clocksource.h~time-smp-friendly-alignment-of-struct-clocksource include/linux/clocksource.h --- a/include/linux/clocksource.h~time-smp-friendly-alignment-of-struct-clocksource +++ a/include/linux/clocksource.h @@ -52,6 +52,9 @@ struct clocksource; * @xtime_interval: Used internally by timekeeping core, please ignore. */ struct clocksource { + /* + * First part of structure is read mostly + */ char *name; struct list_head list; int rating; @@ -63,8 +66,15 @@ struct clocksource { cycle_t (*vread)(void); /* timekeeping specific data, ignore */ - cycle_t cycle_last, cycle_interval; - u64 xtime_nsec, xtime_interval; + cycle_t cycle_interval; + u64 xtime_interval; + /* + * Second part is written at each timer interrupt + * Keep it in a different cache line to dirty no + * more than one cache line. + */ + cycle_t cycle_last ____cacheline_aligned_in_smp; + u64 xtime_nsec; s64 error; #ifdef CONFIG_CLOCKSOURCE_WATCHDOG _