Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

time/sched_clock: Swap update_clock_read_data() latch writes

Swap the writes to the odd and even copies to make the writer critical
section look like all other seqcount_latch writers.

Signed-off-by: Marco Elver <elver@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241104161910.780003-2-elver@google.com

authored by

Marco Elver and committed by
Peter Zijlstra
1139c71d 25cf4fbb

+3 -3
+3 -3
kernel/time/sched_clock.c
··· 119 119 */ 120 120 static void update_clock_read_data(struct clock_read_data *rd) 121 121 { 122 - /* update the backup (odd) copy with the new data */ 123 - cd.read_data[1] = *rd; 124 - 125 122 /* steer readers towards the odd copy */ 126 123 raw_write_seqcount_latch(&cd.seq); 127 124 ··· 127 130 128 131 /* switch readers back to the even copy */ 129 132 raw_write_seqcount_latch(&cd.seq); 133 + 134 + /* update the backup (odd) copy with the new data */ 135 + cd.read_data[1] = *rd; 130 136 } 131 137 132 138 /*