From: Eric Dumazet Date: Tue, 8 May 2007 07:27:57 +0000 (-0700) Subject: time: SMP friendly alignment of struct clocksource X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=329c8d84ca1946c037d9859dc251b56d8b1b4630;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: John Stultz Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- 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 @@ #include #include #include +#include #include #include #include @@ -52,6 +53,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 +67,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