Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1443765
| From | Chris Metcalf <cmetcalf@mellanox.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v13 02/12] vmstat: add vmstat_idle function |
| Date | 2016-07-14 22:50 +0200 |
| Message-ID | <rUVK2-5Zr-25@gated-at.bofh.it> (permalink) |
| References | <rUVK1-5Zr-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 0d96b6b2079d..1168c612a580 100644
--- a/include/linux/vmstat.h
+++ b/include/linux/vmstat.h
@@ -189,6 +189,7 @@ extern void __dec_zone_state(struct zone *, enum zone_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);
@@ -255,6 +256,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 945af7ab624e..d742947df35d 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -1492,6 +1492,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 | Find similar | Unroll thread
[PATCH v13 02/12] vmstat: add vmstat_idle function Chris Metcalf <cmetcalf@mellanox.com> - 2016-07-14 22:50 +0200
csiph-web