From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933510AbdKCRFX (ORCPT ); Fri, 3 Nov 2017 13:05:23 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:56112 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756245AbdKCRFK (ORCPT ); Fri, 3 Nov 2017 13:05:10 -0400 From: Chris Metcalf To: 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 , Michal Hocko , linux-mm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Chris Metcalf Subject: [PATCH v16 01/13] vmstat: add quiet_vmstat_sync function Date: Fri, 3 Nov 2017 13:04:40 -0400 Message-Id: <1509728692-10460-2-git-send-email-cmetcalf@mellanox.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com> References: <1509728692-10460-1-git-send-email-cmetcalf@mellanox.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 ade7cb5f1359..e0b504594593 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -264,6 +264,7 @@ extern void __dec_zone_state(struct zone *, enum zone_stat_item); extern void __dec_node_state(struct pglist_data *, enum node_stat_item); void quiet_vmstat(void); +void quiet_vmstat_sync(void); void cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); @@ -366,6 +367,7 @@ static inline void __dec_node_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 4bb13e72ac97..8ad1b84ca9cf 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1837,6 +1837,15 @@ void quiet_vmstat(void) } /* + * Synchronously quiet vmstat so the work is guaranteed not to run on return. + */ +void quiet_vmstat_sync(void) +{ + cancel_delayed_work_sync(this_cpu_ptr(&vmstat_work)); + refresh_cpu_vm_stats(false); +} + +/* * Shepherd worker thread that checks the * differentials of processors that have their worker * threads for vm statistics updates disabled because of -- 2.1.2