mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chris Metcalf <cmetcalf@mellanox.com>
To: Gilad Ben Yossef <giladb@ezchip.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"Rik van Riel" <riel@redhat.com>, Tejun Heo <tj@kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Christoph Lameter <cl@linux.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Michal Hocko <mhocko@suse.com>, <linux-kernel@vger.kernel.org>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Subject: [PATCH v11 01/13] vmstat: add quiet_vmstat_sync function
Date: Fri, 11 Mar 2016 17:10:11 -0500	[thread overview]
Message-ID: <1457734223-26209-2-git-send-email-cmetcalf@mellanox.com> (raw)
In-Reply-To: <1457734223-26209-1-git-send-email-cmetcalf@mellanox.com>

In commit f01f17d3705b ("mm, vmstat: make quiet_vmstat lighter")
the quiet_vmstat() function became asynchronous, in the sense that
the vmstat work was still scheduled to run on the core when the
function returned.  For task isolation, we need a synchronous
version of the function that guarantees that the vmstat worker
will not run on the core on return from the function.  Add a
quiet_vmstat_sync() function with that semantic.

Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
---
 include/linux/vmstat.h | 2 ++
 mm/vmstat.c            | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index 73fae8c4a5fb..43b2f1c33266 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -190,6 +190,7 @@ extern void dec_zone_state(struct zone *, enum zone_stat_item);
 extern void __dec_zone_state(struct zone *, enum zone_stat_item);
 
 void quiet_vmstat(void);
+void quiet_vmstat_sync(void);
 void cpu_vm_stats_fold(int cpu);
 void refresh_zone_stat_thresholds(void);
 
@@ -251,6 +252,7 @@ static inline void __dec_zone_page_state(struct page *page,
 static inline void refresh_zone_stat_thresholds(void) { }
 static inline void cpu_vm_stats_fold(int cpu) { }
 static inline void quiet_vmstat(void) { }
+static inline void quiet_vmstat_sync(void) { }
 
 static inline void drain_zonestat(struct zone *zone,
 			struct per_cpu_pageset *pset) { }
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 084c6725b373..ff569246fcb5 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1469,6 +1469,15 @@ void quiet_vmstat(void)
 	refresh_cpu_vm_stats(false);
 }
 
+/*
+ * Synchronously quiet vmstat so the work is guaranteed not to run on return.
+ */
+void quiet_vmstat_sync(void)
+{
+	cpumask_set_cpu(smp_processor_id(), cpu_stat_off);
+	cancel_delayed_work_sync(this_cpu_ptr(&vmstat_work));
+	refresh_cpu_vm_stats(false);
+}
 
 /*
  * Shepherd worker thread that checks the
-- 
2.7.2

  reply	other threads:[~2016-03-11 22:10 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 22:10 [PATCH v11 00/13] support "task_isolation" mode Chris Metcalf
2016-03-11 22:10 ` Chris Metcalf [this message]
2016-03-21 14:34   ` [PATCH v11 01/13] vmstat: add quiet_vmstat_sync function Michal Hocko
2016-03-21 15:44     ` Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 02/13] vmstat: add vmstat_idle function Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 03/13] lru_add_drain_all: factor out lru_add_drain_needed Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 04/13] task_isolation: add initial support Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 05/13] task_isolation: support CONFIG_TASK_ISOLATION_ALL Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 06/13] task_isolation: support PR_TASK_ISOLATION_STRICT mode Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 07/13] task_isolation: add debug boot flag Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 08/13] task_isolation: add PR_TASK_ISOLATION_ONE_SHOT flag Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 09/13] arm, tile: turn off timer tick for oneshot_stopped state Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 10/13] arch/x86: enable task isolation functionality Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 11/13] arch/tile: " Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 12/13] arm64: factor work_pending state machine to C Chris Metcalf
2016-03-16 18:19   ` Chris Metcalf
2016-03-11 22:10 ` [PATCH v11 13/13] arch/arm64: enable task isolation functionality Chris Metcalf

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=1457734223-26209-2-git-send-email-cmetcalf@mellanox.com \
    --to=cmetcalf@mellanox.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=cl@linux.com \
    --cc=fweisbec@gmail.com \
    --cc=giladb@ezchip.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mhocko@suse.com \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=will.deacon@arm.com \
    /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

all inboxes | Powered by JetHome®