Skip to content

Commit 1139c71

Browse files
melverPeter Zijlstra
authored andcommitted
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 25cf4fb commit 1139c71

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

kernel/time/sched_clock.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ unsigned long long notrace sched_clock(void)
119119
*/
120120
static void update_clock_read_data(struct clock_read_data *rd)
121121
{
122-
/* update the backup (odd) copy with the new data */
123-
cd.read_data[1] = *rd;
124-
125122
/* steer readers towards the odd copy */
126123
raw_write_seqcount_latch(&cd.seq);
127124

@@ -130,6 +127,9 @@ static void update_clock_read_data(struct clock_read_data *rd)
130127

131128
/* switch readers back to the even copy */
132129
raw_write_seqcount_latch(&cd.seq);
130+
131+
/* update the backup (odd) copy with the new data */
132+
cd.read_data[1] = *rd;
133133
}
134134

135135
/*

0 commit comments

Comments
 (0)