Skip to content

Commit 605da84

Browse files
Frederic WeisbeckerKAGA-KOKO
authored andcommitted
timers/nohz: Restructure and reshuffle struct tick_sched
Restructure and group fields by access in order to optimize cache layout. While at it, also add missing kernel doc for two fields: @last_jiffies and @idle_expires. Reported-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lore.kernel.org/r/20230222144649.624380-2-frederic@kernel.org
1 parent e9523a0 commit 605da84

1 file changed

Lines changed: 41 additions & 25 deletions

File tree

kernel/time/tick-sched.h

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,81 @@ enum tick_nohz_mode {
2222

2323
/**
2424
* struct tick_sched - sched tick emulation and no idle tick control/stats
25-
* @sched_timer: hrtimer to schedule the periodic tick in high
26-
* resolution mode
27-
* @check_clocks: Notification mechanism about clocksource changes
28-
* @nohz_mode: Mode - one state of tick_nohz_mode
25+
*
2926
* @inidle: Indicator that the CPU is in the tick idle mode
3027
* @tick_stopped: Indicator that the idle tick has been stopped
3128
* @idle_active: Indicator that the CPU is actively in the tick idle mode;
3229
* it is reset during irq handling phases.
33-
* @do_timer_lst: CPU was the last one doing do_timer before going idle
30+
* @do_timer_last: CPU was the last one doing do_timer before going idle
3431
* @got_idle_tick: Tick timer function has run with @inidle set
32+
* @stalled_jiffies: Number of stalled jiffies detected across ticks
33+
* @last_tick_jiffies: Value of jiffies seen on last tick
34+
* @sched_timer: hrtimer to schedule the periodic tick in high
35+
* resolution mode
3536
* @last_tick: Store the last tick expiry time when the tick
3637
* timer is modified for nohz sleeps. This is necessary
3738
* to resume the tick timer operation in the timeline
3839
* when the CPU returns from nohz sleep.
3940
* @next_tick: Next tick to be fired when in dynticks mode.
4041
* @idle_jiffies: jiffies at the entry to idle for idle time accounting
42+
* @idle_waketime: Time when the idle was interrupted
43+
* @idle_entrytime: Time when the idle call was entered
44+
* @nohz_mode: Mode - one state of tick_nohz_mode
45+
* @last_jiffies: Base jiffies snapshot when next event was last computed
46+
* @timer_expires_base: Base time clock monotonic for @timer_expires
47+
* @timer_expires: Anticipated timer expiration time (in case sched tick is stopped)
48+
* @next_timer: Expiry time of next expiring timer for debugging purpose only
49+
* @idle_expires: Next tick in idle, for debugging purpose only
4150
* @idle_calls: Total number of idle calls
4251
* @idle_sleeps: Number of idle calls, where the sched tick was stopped
43-
* @idle_entrytime: Time when the idle call was entered
44-
* @idle_waketime: Time when the idle was interrupted
4552
* @idle_exittime: Time when the idle state was left
4653
* @idle_sleeptime: Sum of the time slept in idle with sched tick stopped
4754
* @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding
48-
* @timer_expires: Anticipated timer expiration time (in case sched tick is stopped)
49-
* @timer_expires_base: Base time clock monotonic for @timer_expires
50-
* @next_timer: Expiry time of next expiring timer for debugging purpose only
5155
* @tick_dep_mask: Tick dependency mask - is set, if someone needs the tick
52-
* @last_tick_jiffies: Value of jiffies seen on last tick
53-
* @stalled_jiffies: Number of stalled jiffies detected across ticks
56+
* @check_clocks: Notification mechanism about clocksource changes
5457
*/
5558
struct tick_sched {
56-
struct hrtimer sched_timer;
57-
unsigned long check_clocks;
58-
enum tick_nohz_mode nohz_mode;
59-
59+
/* Common flags */
6060
unsigned int inidle : 1;
6161
unsigned int tick_stopped : 1;
6262
unsigned int idle_active : 1;
6363
unsigned int do_timer_last : 1;
6464
unsigned int got_idle_tick : 1;
6565

66+
/* Tick handling: jiffies stall check */
67+
unsigned int stalled_jiffies;
68+
unsigned long last_tick_jiffies;
69+
70+
/* Tick handling */
71+
struct hrtimer sched_timer;
6672
ktime_t last_tick;
6773
ktime_t next_tick;
6874
unsigned long idle_jiffies;
69-
unsigned long idle_calls;
70-
unsigned long idle_sleeps;
71-
ktime_t idle_entrytime;
7275
ktime_t idle_waketime;
73-
ktime_t idle_exittime;
74-
ktime_t idle_sleeptime;
75-
ktime_t iowait_sleeptime;
76+
77+
/* Idle entry */
78+
ktime_t idle_entrytime;
79+
80+
/* Tick stop */
81+
enum tick_nohz_mode nohz_mode;
7682
unsigned long last_jiffies;
77-
u64 timer_expires;
7883
u64 timer_expires_base;
84+
u64 timer_expires;
7985
u64 next_timer;
8086
ktime_t idle_expires;
87+
unsigned long idle_calls;
88+
unsigned long idle_sleeps;
89+
90+
/* Idle exit */
91+
ktime_t idle_exittime;
92+
ktime_t idle_sleeptime;
93+
ktime_t iowait_sleeptime;
94+
95+
/* Full dynticks handling */
8196
atomic_t tick_dep_mask;
82-
unsigned long last_tick_jiffies;
83-
unsigned int stalled_jiffies;
97+
98+
/* Clocksource changes */
99+
unsigned long check_clocks;
84100
};
85101

86102
extern struct tick_sched *tick_get_tick_sched(int cpu);

0 commit comments

Comments
 (0)