aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-10-15 16:01:50 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-10-15 16:01:50 -0400
commit176bed1de5bf977938cad26551969eca8f0883b1 (patch)
tree45adb32e0c98e146ada11f1db777dfd0eced1bbc
parent995e2fe9a4904c0b83c4eead7db42f5d52b09a85 (diff)
vmstat: explicitly schedule per-cpu work on the CPU we need it to run on
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. Cc: Christoph Lameter <cl@linux.com> Cc: Tejun Heo <tj@kernel.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/vmstat.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 4f5cd974e11a..fbf14485a049 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1363,15 +1363,16 @@ static cpumask_var_t cpu_stat_off;
1363 1363
1364static void vmstat_update(struct work_struct *w) 1364static void vmstat_update(struct work_struct *w)
1365{ 1365{
1366 if (refresh_cpu_vm_stats()) 1366 if (refresh_cpu_vm_stats()) {
1367 /* 1367 /*
1368 * Counters were updated so we expect more updates 1368 * Counters were updated so we expect more updates
1369 * to occur in the future. Keep on running the 1369 * to occur in the future. Keep on running the
1370 * update worker thread. 1370 * update worker thread.
1371 */ 1371 */
1372 schedule_delayed_work(this_cpu_ptr(&vmstat_work), 1372 schedule_delayed_work_on(smp_processor_id(),
1373 this_cpu_ptr(&vmstat_work),
1373 round_jiffies_relative(sysctl_stat_interval)); 1374 round_jiffies_relative(sysctl_stat_interval));
1374 else { 1375 } else {
1375 /* 1376 /*
1376 * We did not update any counters so the app may be in 1377 * We did not update any counters so the app may be in
1377 * a mode where it does not cause counter updates. 1378 * a mode where it does not cause counter updates.