Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1459110

[PATCH v14 02/14] vmstat: add vmstat_idle function

From Chris Metcalf <cmetcalf@mellanox.com>
Newsgroups linux.kernel
Subject [PATCH v14 02/14] vmstat: add vmstat_idle function
Date 2016-08-09 22:40 +0200
Message-ID <s4lYC-3WM-25@gated-at.bofh.it> (permalink)
References <s4lYB-3WM-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


This function checks to see if a vmstat worker is not running,
and the vmstat diffs don't require an update.  The function is
called from the task-isolation code to see if we need to
actually do some work to quiet vmstat.

Acked-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
---
 include/linux/vmstat.h |  2 ++
 mm/vmstat.c            | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
index fab62aa74079..69b6cc4be909 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -235,6 +235,7 @@ extern void __dec_node_state(struct pglist_data *, enum node_stat_item);
 
 void quiet_vmstat(void);
 void quiet_vmstat_sync(void);
+bool vmstat_idle(void);
 void cpu_vm_stats_fold(int cpu);
 void refresh_zone_stat_thresholds(void);
 
@@ -338,6 +339,7 @@ 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 bool vmstat_idle(void) { return true; }
 
 static inline void drain_zonestat(struct zone *zone,
 			struct per_cpu_pageset *pset) { }
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 57fc29750da6..7dd17c06d3a7 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1763,6 +1763,16 @@ void quiet_vmstat_sync(void)
 }
 
 /*
+ * Report on whether vmstat processing is quiesced on the core currently:
+ * no vmstat worker running and no vmstat updates to perform.
+ */
+bool vmstat_idle(void)
+{
+	return !delayed_work_pending(this_cpu_ptr(&vmstat_work)) &&
+		!need_update(smp_processor_id());
+}
+
+/*
  * Shepherd worker thread that checks the
  * differentials of processors that have their worker
  * threads for vm statistics updates disabled because of
-- 
2.7.2

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v14 00/14] support "task_isolation" mode Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 06/14] arch/x86: enable task isolation functionality Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
    Re: [PATCH v14 06/14] arch/x86: enable task isolation functionality Andy Lutomirski <luto@amacapital.net> - 2016-08-10 21:20 +0200
      Re: [PATCH v14 06/14] arch/x86: enable task isolation functionality Andy Lutomirski <luto@amacapital.net> - 2016-08-10 22:10 +0200
    Re: [PATCH v14 06/14] arch/x86: enable task isolation functionality Andy Lutomirski <luto@amacapital.net> - 2016-08-10 21:20 +0200
  [PATCH v14 10/14] arm, tile: turn off timer tick for oneshot_stopped state Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 02/14] vmstat: add vmstat_idle function Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 08/14] arch/arm64: enable task isolation functionality Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 05/14] task_isolation: track asynchronous interrupts Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 09/14] arch/tile: enable task isolation functionality Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 04/14] task_isolation: add initial support Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200
  [PATCH v14 07/14] arm64: factor work_pending state machine to C Chris Metcalf <cmetcalf@mellanox.com> - 2016-08-09 22:40 +0200

csiph-web