]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
time/sched_clock: Swap update_clock_read_data() latch writes
authorMarco Elver <elver@google.com>
Mon, 4 Nov 2024 15:43:05 +0000 (16:43 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Tue, 5 Nov 2024 11:55:34 +0000 (12:55 +0100)
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
kernel/time/sched_clock.c

index 68d6c1190ac7f8c6f6958c269b9f8e5ca7a31c7a..85595fcf6aa2203b021fb12b4344048939cfa44c 100644 (file)
@@ -119,9 +119,6 @@ unsigned long long notrace sched_clock(void)
  */
 static void update_clock_read_data(struct clock_read_data *rd)
 {
-       /* update the backup (odd) copy with the new data */
-       cd.read_data[1] = *rd;
-
        /* steer readers towards the odd copy */
        raw_write_seqcount_latch(&cd.seq);
 
@@ -130,6 +127,9 @@ static void update_clock_read_data(struct clock_read_data *rd)
 
        /* switch readers back to the even copy */
        raw_write_seqcount_latch(&cd.seq);
+
+       /* update the backup (odd) copy with the new data */
+       cd.read_data[1] = *rd;
 }
 
 /*