From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) by kanga.kvack.org (Postfix) with ESMTP id 728F06B0266 for ; Tue, 5 Apr 2016 13:39:04 -0400 (EDT) Received: by mail-oi0-f43.google.com with SMTP id y204so26569539oie.3 for ; Tue, 05 Apr 2016 10:39:04 -0700 (PDT) Received: from emea01-am1-obe.outbound.protection.outlook.com (mail-am1on0065.outbound.protection.outlook.com. [157.56.112.65]) by mx.google.com with ESMTPS id p7si14484289oew.31.2016.04.05.10.39.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Apr 2016 10:39:03 -0700 (PDT) From: Chris Metcalf Subject: [PATCH v12 02/13] vmstat: add vmstat_idle function Date: Tue, 5 Apr 2016 13:38:31 -0400 Message-ID: <1459877922-15512-3-git-send-email-cmetcalf@mellanox.com> In-Reply-To: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> References: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: To: Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , Rik van Riel , Tejun Heo , Frederic Weisbecker , Thomas Gleixner , "Paul E. McKenney" , Christoph Lameter , Viresh Kumar , Catalin Marinas , Will Deacon , Andy Lutomirski , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Chris Metcalf 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 Signed-off-by: Chris Metcalf --- include/linux/vmstat.h | 2 ++ mm/vmstat.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 43b2f1c33266..504ebd1fdf33 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -191,6 +191,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); @@ -253,6 +254,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 7a1cfe383349..fa34ea480ac0 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1469,6 +1469,18 @@ 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) +{ + int cpu = smp_processor_id(); + return cpumask_test_cpu(cpu, cpu_stat_off) && + !delayed_work_pending(this_cpu_ptr(&vmstat_work)) && + !need_update(cpu); +} + +/* * Shepherd worker thread that checks the * differentials of processors that have their worker * threads for vm statistics updates disabled because of -- 2.7.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: email@kvack.org