Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934452AbcCIXPK (ORCPT ); Wed, 9 Mar 2016 18:15:10 -0500 Received: from youngberry.canonical.com ([91.189.89.112]:40508 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754228AbcCIXO6 (ORCPT ); Wed, 9 Mar 2016 18:14:58 -0500 From: Kamal Mostafa To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Christoph Lameter , Tejun Heo , Mike Galbraith , Michal Hocko , Linus Torvalds , Jiri Slaby , Kamal Mostafa Subject: [PATCH 3.13.y-ckt 001/138] vmstat: explicitly schedule per-cpu work on the CPU we need it to run on Date: Wed, 9 Mar 2016 15:12:08 -0800 Message-Id: <1457565265-15195-2-git-send-email-kamal@canonical.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1457565265-15195-1-git-send-email-kamal@canonical.com> References: <1457565265-15195-1-git-send-email-kamal@canonical.com> X-Extended-Stable: 3.13 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2007 Lines: 55 3.13.11-ckt36 -stable review patch. If anyone has any objections, please let me know. ---8<------------------------------------------------------------ From: Linus Torvalds 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 Cc: Tejun Heo Cc: Mike Galbraith Cc: Michal Hocko Signed-off-by: Linus Torvalds Signed-off-by: Jiri Slaby [ kamal: backport to 3.13-stable: use queue_delayed_work_on() ] Signed-off-by: Kamal Mostafa --- mm/vmstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index f143e1d..eb4bc96 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1219,7 +1219,8 @@ int sysctl_stat_interval __read_mostly = HZ; static void vmstat_update(struct work_struct *w) { refresh_cpu_vm_stats(); - queue_delayed_work(vmstat_wq, &__get_cpu_var(vmstat_work), + queue_delayed_work_on(smp_processor_id(), vmstat_wq, + &__get_cpu_var(vmstat_work), round_jiffies_relative(sysctl_stat_interval)); } -- 2.7.0