Skip to content

Commit

Permalink
vdso: Move architecture related data before basetime data
Browse files Browse the repository at this point in the history
Architecture related vdso data is required in the fast path when reading
CLOCK_MONOTONIC or CLOCK_REALTIME. At the moment, this information is
located at the end of the vdso_time_data structure, which is a suboptimal
cache layout.

Move the architecture specific VDSO data right before the basetime
information, which is always required. This change does not have an impact
on architectures with CONFIG_ARCH_HAS_VDSO_DATA=n. Architectures, which
have it enabled, gain a better cache layout.

Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de>
Signed-off-by: Nam Cao <namcao@linutronix.de>
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/all/20250303-vdso-clock-v1-18-c1b5c69a166f@linutronix.de
  • Loading branch information
Anna-Maria Behnsen authored and Thomas Gleixner committed Mar 8, 2025
1 parent ed0c10f commit 97a5a90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions include/vdso/datapage.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ struct vdso_timestamp {

/**
* struct vdso_time_data - vdso datapage representation
* @arch_data: architecture specific data (optional, defaults
* to an empty struct)
* @seq: timebase sequence counter
* @clock_mode: clock mode
* @cycle_last: timebase at clocksource init
Expand All @@ -83,8 +85,6 @@ struct vdso_timestamp {
* @tz_dsttime: type of DST correction
* @hrtimer_res: hrtimer resolution
* @__unused: unused
* @arch_data: architecture specific data (optional, defaults
* to an empty struct)
*
* vdso_time_data will be accessed by 64 bit and compat code at the same time
* so we should be careful before modifying this structure.
Expand All @@ -105,6 +105,8 @@ struct vdso_timestamp {
* offset must be zero.
*/
struct vdso_time_data {
struct arch_vdso_time_data arch_data;

u32 seq;

s32 clock_mode;
Expand All @@ -125,8 +127,6 @@ struct vdso_time_data {
s32 tz_dsttime;
u32 hrtimer_res;
u32 __unused;

struct arch_vdso_time_data arch_data;
} ____cacheline_aligned;

#define vdso_clock vdso_time_data
Expand Down

0 comments on commit 97a5a90

Please sign in to comment.