Skip to content

Commit 9184a2b

Browse files
Peter Zijlstragregkh
authored andcommitted
sched/psi: Fix psi_seq initialization
[ Upstream commit 99b773d ] 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 <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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 9ea1cc8 commit 9184a2b

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

kernel/sched/psi.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ struct psi_group psi_system = {
172172
.pcpu = &system_group_pcpu,
173173
};
174174

175-
static DEFINE_PER_CPU(seqcount_t, psi_seq);
175+
static DEFINE_PER_CPU(seqcount_t, psi_seq) = SEQCNT_ZERO(psi_seq);
176176

177177
static inline void psi_write_begin(int cpu)
178178
{
@@ -200,11 +200,7 @@ static void poll_timer_fn(struct timer_list *t);
200200

201201
static void group_init(struct psi_group *group)
202202
{
203-
int cpu;
204-
205203
group->enabled = true;
206-
for_each_possible_cpu(cpu)
207-
seqcount_init(per_cpu_ptr(&psi_seq, cpu));
208204
group->avg_last_update = sched_clock();
209205
group->avg_next_update = group->avg_last_update + psi_period;
210206
mutex_init(&group->avgs_lock);

0 commit comments

Comments
 (0)