Skip to content

Commit 99b773d

Browse files
Peter Zijlstratorvalds
authored andcommitted
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: 570c8ef ("sched/psi: Optimize psi_group_change() cpu_clock() usage") Reported-by: Chris Mason <[email protected]> Suggested-by: Beata Michalska <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent d632ab8 commit 99b773d

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

kernel/sched/psi.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ struct psi_group psi_system = {
176176
.pcpu = &system_group_pcpu,
177177
};
178178

179-
static DEFINE_PER_CPU(seqcount_t, psi_seq);
179+
static DEFINE_PER_CPU(seqcount_t, psi_seq) = SEQCNT_ZERO(psi_seq);
180180

181181
static inline void psi_write_begin(int cpu)
182182
{
@@ -204,11 +204,7 @@ static void poll_timer_fn(struct timer_list *t);
204204

205205
static void group_init(struct psi_group *group)
206206
{
207-
int cpu;
208-
209207
group->enabled = true;
210-
for_each_possible_cpu(cpu)
211-
seqcount_init(per_cpu_ptr(&psi_seq, cpu));
212208
group->avg_last_update = sched_clock();
213209
group->avg_next_update = group->avg_last_update + psi_period;
214210
mutex_init(&group->avgs_lock);

0 commit comments

Comments
 (0)