Skip to content

Commit aadd6e5

Browse files
a-darwishwilldeacon
authored andcommitted
time/sched_clock: Use raw_read_seqcount_latch()
sched_clock uses seqcount_t latching to switch between two storage places protected by the sequence counter. This allows it to have interruptible, NMI-safe, seqcount_t write side critical sections. Since 7fc2632 ("seqlock: Introduce raw_read_seqcount_latch()"), raw_read_seqcount_latch() became the standardized way for seqcount_t latch read paths. Due to the dependent load, it also has one read memory barrier less than the currently used raw_read_seqcount() API. Use raw_read_seqcount_latch() for the seqcount_t latch read path. Signed-off-by: Ahmed S. Darwish <[email protected]> Signed-off-by: Leo Yan <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] References: 1809bfa ("timers, sched/clock: Avoid deadlock during read from NMI") Signed-off-by: Will Deacon <[email protected]>
1 parent 1b86abc commit aadd6e5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/time/sched_clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift)
7070

7171
struct clock_read_data *sched_clock_read_begin(unsigned int *seq)
7272
{
73-
*seq = raw_read_seqcount(&cd.seq);
73+
*seq = raw_read_seqcount_latch(&cd.seq);
7474
return cd.read_data + (*seq & 1);
7575
}
7676

0 commit comments

Comments
 (0)