summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-15 13:01:50 -0700
committerJiri Slaby <jslaby@suse.cz>2016-02-12 08:58:05 +0100
commit933f407f064e9338b17df510197dc5929e4c25c3 (patch)
treed32846267863412528761e538139764f33bf7d21
parent6b443a1b7c6ba75465730e74013b165a55bd3e9e (diff)
downloadlwn-933f407f064e9338b17df510197dc5929e4c25c3.tar.gz
lwn-933f407f064e9338b17df510197dc5929e4c25c3.zip
vmstat: explicitly schedule per-cpu work on the CPU we need it to run on
commit 176bed1de5bf977938cad26551969eca8f0883b1 upstream. The vmstat code uses "schedule_delayed_work_on()" to do the initial startup of the delayed work on the right CPU, but then once it was started it would use the non-cpu-specific "schedule_delayed_work()" to re-schedule it on that CPU. That just happened to schedule it on the same CPU historically (well, in almost all situations), but the code _requires_ this work to be per-cpu, and should say so explicitly rather than depend on the non-cpu-specific scheduling to schedule on the current CPU. The timer code is being changed to not be as single-minded in always running things on the calling CPU. See also commit 874bbfe600a6 ("workqueue: make sure delayed work run in local cpu") that for now maintains the local CPU guarantees just in case there are other broken users that depended on the accidental behavior. js: 3.12 backport Cc: Christoph Lameter <cl@linux.com> Cc: Tejun Heo <tj@kernel.org> Cc: Mike Galbraith <mgalbraith@suse.com> Cc: Michal Hocko <mhocko@suse.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r--mm/vmstat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index f7ca04482299..1dbd89d2fb9c 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1221,7 +1221,8 @@ int sysctl_stat_interval __read_mostly = HZ;
static void vmstat_update(struct work_struct *w)
{
refresh_cpu_vm_stats();
- schedule_delayed_work(&__get_cpu_var(vmstat_work),
+ schedule_delayed_work_on(smp_processor_id(),
+ &__get_cpu_var(vmstat_work),
round_jiffies_relative(sysctl_stat_interval));
}