linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@ezchip.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>, Michal Hocko <mhocko@suse.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Lai Jiangshan <jiangshanlai@gmail.com>, Shaohua Li <shli@fb.com>,
	linux-mm <linux-mm@kvack.org>, Tejun Heo <tj@kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Subject: [PATCH] vmstat_update: ensure work remains on the same core
Date: Fri, 16 Oct 2015 15:51:33 -0400	[thread overview]
Message-ID: <1445025093-32639-1-git-send-email-cmetcalf@ezchip.com> (raw)
In-Reply-To: <CA+55aFyzsMYcRX3V5CEWB4Zb-9BuRGCjib3DMXuX5y9nBWiZ1w@mail.gmail.com>

By using schedule_delayed_work(), we are preferring the local
core for the work, but not requiring it.  In my task
isolation experiments, I saw a nohz_full core's vmstat_update
end up running on a housekeeping core, and when the two works
ran back-to-back, we triggered the VM_BUG_ON() at the
end of the function.

Switch to using schedule_delayed_work_on(smp_processor_id(), ...).

Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
---
This change that I made a few days ago in my local tree is
particularly amusing given that the thread I am appending this
email to ("workqueue fixes for v4.3-rc5") also fixes the symptoms
of the bug I saw, but I wasn't aware of it until just now.  And it
took a while for me to track it down!  I think this is probably a
"belt and suspenders" kind of issue where it makes sense to fix it
on both sides of the API, however.

 mm/vmstat.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index cf7d324f16e2..5c6bd7e5db07 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1369,7 +1369,8 @@ static void vmstat_update(struct work_struct *w)
 		 * to occur in the future. Keep on running the
 		 * update worker thread.
 		 */
-		schedule_delayed_work(this_cpu_ptr(&vmstat_work),
+		schedule_delayed_work_on(smp_processor_id(),
+			this_cpu_ptr(&vmstat_work),
 			round_jiffies_relative(sysctl_stat_interval));
 	else {
 		/*
-- 
2.1.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2015-10-16 19:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151013214952.GB23106@mtj.duckdns.org>
2015-10-14 16:30 ` [GIT PULL] workqueue fixes for v4.3-rc5 Linus Torvalds
2015-10-14 16:57   ` Tejun Heo
2015-10-14 17:36     ` Linus Torvalds
2015-10-14 17:57       ` Christoph Lameter
2015-10-14 18:37         ` Linus Torvalds
2015-10-14 18:58           ` Christoph Lameter
2015-10-14 19:01           ` Linus Torvalds
2015-10-14 19:02       ` Tejun Heo
2015-10-14 19:16         ` Linus Torvalds
2015-10-14 19:38           ` Tejun Heo
2015-10-14 20:10             ` Linus Torvalds
2015-10-14 20:24               ` Tejun Heo
2015-10-19  3:51                 ` Mike Galbraith
2015-10-16 19:51               ` Chris Metcalf [this message]
2015-10-16 19:54                 ` [PATCH] vmstat_update: ensure work remains on the same core Linus Torvalds
2015-10-14 18:03   ` [GIT PULL] workqueue fixes for v4.3-rc5 Christoph Lameter
2015-10-14 18:40     ` Linus Torvalds
2015-10-14 18:59       ` Christoph Lameter
2015-10-14 19:10         ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1445025093-32639-1-git-send-email-cmetcalf@ezchip.com \
    --to=cmetcalf@ezchip.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=shli@fb.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox