History

Merge branch 'for-5.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup fix from Tejun Heo: "One commit to fix a possible A-A deadlock around u64_stats_sync on 32bit machines caused by updating it without disabling IRQ when it may be read from IRQ context" * 'for-5.14-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: cgroup: rstat: fix A-A deadlock on 32bit around u64_stats_sync

Linus Torvalds committed 5 years ago

Commit 9a73fa32 parents 36a21d5 c3df5fb2 files · +19 −14Browse files

Showing the changes to kernel (1 of 2 files). Show all

Unified · Split

kernel/cgroup/rstat.c+11−8
@@ -347,19 +347,20 @@ static void cgroup_base_stat_flush(struct cgroup *cgrp, int cpu) · 346 unmodified lines
347347 }
348348
349349 static struct cgroup_rstat_cpu *
350−cgroup_base_stat_cputime_account_begin(struct cgroup *cgrp)
350+cgroup_base_stat_cputime_account_begin(struct cgroup *cgrp, unsigned long *flags)
351351 {
352352 struct cgroup_rstat_cpu *rstatc;
353353
354354 rstatc = get_cpu_ptr(cgrp->rstat_cpu);
355− u64_stats_update_begin(&rstatc->bsync);
355+ *flags = u64_stats_update_begin_irqsave(&rstatc->bsync);
356356 return rstatc;
357357 }
358358
359359 static void cgroup_base_stat_cputime_account_end(struct cgroup *cgrp,
360− struct cgroup_rstat_cpu *rstatc)
360+ struct cgroup_rstat_cpu *rstatc,
361+ unsigned long flags)
361362 {
362− u64_stats_update_end(&rstatc->bsync);
363+ u64_stats_update_end_irqrestore(&rstatc->bsync, flags);
363364 cgroup_rstat_updated(cgrp, smp_processor_id());
364365 put_cpu_ptr(rstatc);
365366 }
@@ -367,18 +368,20 @@ static void cgroup_base_stat_cputime_account_end(struct cgroup *cgrp, · 1 unmodified line
367368 void __cgroup_account_cputime(struct cgroup *cgrp, u64 delta_exec)
368369 {
369370 struct cgroup_rstat_cpu *rstatc;
371+ unsigned long flags;
370372
371− rstatc = cgroup_base_stat_cputime_account_begin(cgrp);
373+ rstatc = cgroup_base_stat_cputime_account_begin(cgrp, &flags);
372374 rstatc->bstat.cputime.sum_exec_runtime += delta_exec;
373− cgroup_base_stat_cputime_account_end(cgrp, rstatc);
375+ cgroup_base_stat_cputime_account_end(cgrp, rstatc, flags);
374376 }
375377
376378 void __cgroup_account_cputime_field(struct cgroup *cgrp,
377379 enum cpu_usage_stat index, u64 delta_exec)
378380 {
379381 struct cgroup_rstat_cpu *rstatc;
382+ unsigned long flags;
380383
381− rstatc = cgroup_base_stat_cputime_account_begin(cgrp);
384+ rstatc = cgroup_base_stat_cputime_account_begin(cgrp, &flags);
382385
383386 switch (index) {
384387 case CPUTIME_USER:
@@ -394,7 +397,7 @@ void __cgroup_account_cputime_field(struct cgroup *cgrp, · 9 unmodified lines
394397 break;
395398 }
396399
397− cgroup_base_stat_cputime_account_end(cgrp, rstatc);
400+ cgroup_base_stat_cputime_account_end(cgrp, rstatc, flags);
398401 }
399402
400403 /*

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t