From patchwork Mon Feb 22 17:52:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamal Mostafa X-Patchwork-Id: 586433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id AC85A140BFD; Tue, 23 Feb 2016 04:52:52 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1aXufC-0005CZ-4y; Mon, 22 Feb 2016 17:52:50 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1aXuf7-0005CO-3P for kernel-team@lists.ubuntu.com; Mon, 22 Feb 2016 17:52:45 +0000 Received: from 1.general.kamal.us.vpn ([10.172.68.52] helo=fourier) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1aXuf6-00086O-N6 for kernel-team@lists.ubuntu.com; Mon, 22 Feb 2016 17:52:44 +0000 Received: from kamal by fourier with local (Exim 4.86) (envelope-from ) id 1aXuf4-0005OL-1x for kernel-team@lists.ubuntu.com; Mon, 22 Feb 2016 09:52:42 -0800 From: Kamal Mostafa To: kernel-team@lists.ubuntu.com Subject: [Trusty] vmstat: explicitly schedule per-cpu work on the CPU we need it to run on Date: Mon, 22 Feb 2016 09:52:40 -0800 Message-Id: <1456163561-20691-1-git-send-email-kamal@whence.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1456163501-20625-1-git-send-email-kamal@whence.com> References: <1456163501-20625-1-git-send-email-kamal@whence.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Linus Torvalds BugLink: http://bugs.launchpad.net/bugs/1546320 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)); }