clocksource: Restructure clocksource struct members

Group the hot path members of struct clocksource together so we have a
better cache line footprint. Make it cacheline aligned.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Link: http://lkml.kernel.org/r/%3C20110518210136.003081882%40linutronix.de%3E
This commit is contained in:
Thomas Gleixner 2011-05-18 21:33:40 +00:00
parent a18f22a968
commit 369db4c952
1 changed files with 14 additions and 18 deletions

View File

@ -159,42 +159,38 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
*/ */
struct clocksource { struct clocksource {
/* /*
* First part of structure is read mostly * Hotpath data, fits in a single cache line when the
* clocksource itself is cacheline aligned.
*/ */
const char *name;
struct list_head list;
int rating;
cycle_t (*read)(struct clocksource *cs); cycle_t (*read)(struct clocksource *cs);
int (*enable)(struct clocksource *cs); cycle_t cycle_last;
void (*disable)(struct clocksource *cs);
cycle_t mask; cycle_t mask;
u32 mult; u32 mult;
u32 shift; u32 shift;
u64 max_idle_ns; u64 max_idle_ns;
unsigned long flags;
cycle_t (*vread)(void);
void (*suspend)(struct clocksource *cs);
void (*resume)(struct clocksource *cs);
#ifdef CONFIG_IA64 #ifdef CONFIG_IA64
void *fsys_mmio; /* used by fsyscall asm code */ void *fsys_mmio; /* used by fsyscall asm code */
#define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr)) #define CLKSRC_FSYS_MMIO_SET(mmio, addr) ((mmio) = (addr))
#else #else
#define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0) #define CLKSRC_FSYS_MMIO_SET(mmio, addr) do { } while (0)
#endif #endif
const char *name;
/* struct list_head list;
* Second part is written at each timer interrupt int rating;
* Keep it in a different cache line to dirty no cycle_t (*vread)(void);
* more than one cache line. int (*enable)(struct clocksource *cs);
*/ void (*disable)(struct clocksource *cs);
cycle_t cycle_last ____cacheline_aligned_in_smp; unsigned long flags;
void (*suspend)(struct clocksource *cs);
void (*resume)(struct clocksource *cs);
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG #ifdef CONFIG_CLOCKSOURCE_WATCHDOG
/* Watchdog related data, used by the framework */ /* Watchdog related data, used by the framework */
struct list_head wd_list; struct list_head wd_list;
cycle_t wd_last; cycle_t wd_last;
#endif #endif
}; } ____cacheline_aligned;
/* /*
* Clock source flags bits:: * Clock source flags bits::