Skip to content

Commit 8fd4b4c

Browse files
Peter Zijlstraopsiff
authored andcommitted
sched/psi: Fix psi_seq initialization
[ Upstream commit 99b773d720aeea1ef2170dce5fcfa80649e26b78 ] 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 <[email protected]> Suggested-by: Beata Michalska <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit 3df959fd51d6b58805f15f21b78ba57bf6b07dfc)
1 parent 904d5ec commit 8fd4b4c

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
@@ -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)