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

Configure Feed

Select the types of activity you want to include in your feed.

sched/psi: Fix psi_seq initialization

With the seqcount moved out of the group into a global psi_seq,
re-initializing the seqcount on group creation is causing seqcount
corruption.

Fixes: 570c8efd5eb7 ("sched/psi: Optimize psi_group_change() cpu_clock() usage")
Reported-by: Chris Mason <clm@meta.com>
Suggested-by: Beata Michalska <beata.michalska@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Peter Zijlstra and committed by
Linus Torvalds
99b773d7 d632ab86

+1 -5
+1 -5
kernel/sched/psi.c
··· 176 176 .pcpu = &system_group_pcpu, 177 177 }; 178 178 179 - static DEFINE_PER_CPU(seqcount_t, psi_seq); 179 + static DEFINE_PER_CPU(seqcount_t, psi_seq) = SEQCNT_ZERO(psi_seq); 180 180 181 181 static inline void psi_write_begin(int cpu) 182 182 { ··· 204 204 205 205 static void group_init(struct psi_group *group) 206 206 { 207 - int cpu; 208 - 209 207 group->enabled = true; 210 - for_each_possible_cpu(cpu) 211 - seqcount_init(per_cpu_ptr(&psi_seq, cpu)); 212 208 group->avg_last_update = sched_clock(); 213 209 group->avg_next_update = group->avg_last_update + psi_period; 214 210 mutex_init(&group->avgs_lock);