Messages in this thread Patch in this message | | | From | Chris Metcalf <> | Subject | [PATCH v7 01/11] vmstat: provide a function to quiet down the diff processing | Date | Mon, 28 Sep 2015 11:17:16 -0400 |
| |
From: Christoph Lameter <cl@linux.com>
quiet_vmstat() can be called in anticipation of a OS "quiet" period where no tick processing should be triggered. quiet_vmstat() will fold all pending differentials into the global counters and disable the vmstat_worker processing.
Note that the shepherd thread will continue scanning the differentials from another processor and will reenable the vmstat workers if it detects any changes.
Signed-off-by: Christoph Lameter <cl@linux.com> --- include/linux/vmstat.h | 2 ++ mm/vmstat.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+)
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 82e7db7f7100..c013b8d8e434 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -211,6 +211,7 @@ extern void __inc_zone_state(struct zone *, enum zone_stat_item); 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 cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); @@ -272,6 +273,7 @@ static inline void __dec_zone_page_state(struct page *page, static inline void refresh_cpu_vm_stats(int cpu) { } 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 drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset) { } diff --git a/mm/vmstat.c b/mm/vmstat.c index 4f5cd974e11a..cf7d324f16e2 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1394,6 +1394,20 @@ static void vmstat_update(struct work_struct *w) } /* + * Switch off vmstat processing and then fold all the remaining differentials + * until the diffs stay at zero. The function is used by NOHZ and can only be + * invoked when tick processing is not active. + */ +void quiet_vmstat(void) +{ + do { + if (!cpumask_test_and_set_cpu(smp_processor_id(), cpu_stat_off)) + cancel_delayed_work(this_cpu_ptr(&vmstat_work)); + + } while (refresh_cpu_vm_stats()); +} + +/* * Check if the diffs for a certain cpu indicate that * an update is needed. */ -- 2.1.2
| |