From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E54EFE75458 for ; Wed, 24 Dec 2025 13:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RuGPUARzFtv6rCMZtRiKBx+99393ISZnJwgaUxtzjRU=; b=Drknmq/HwCP0cCqOLJxkIfREmG NE6lsMXQiZsnZgq9bxNUjJ4XIWshytaikY98/hTJq5+Myhlxvzmn3PkVLA+wrivpPJFx/ZIps7qOL 5cSqhlZVTYP1sYOntA89qyxP7VVZuWGCo2VFiA5+W4qxV72kH+C8BdCZWRBj84bV7wloyyTOuFhuD 9yNQ6SO6zIRvsLKpIiyV8/1GwxiEgSpxNx8FXcOtYng2IDklMUjUU7lOex+ThKHB/rbV3BDx0iLXu Nse6EfnSPAxekTW6fiJWu3kGbFwiOMIe+J3+q74pIwZsDc8OqO8sTxR5/vGgKjYgesLvERfKzN/LC lNCXTDPw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vYPMh-0000000GwGp-2CRC; Wed, 24 Dec 2025 13:57:23 +0000 Received: from sea.source.kernel.org ([172.234.252.31]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vYPMf-0000000GwFS-1JBd for linux-arm-kernel@lists.infradead.org; Wed, 24 Dec 2025 13:57:22 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id 28A8B4076B; Wed, 24 Dec 2025 13:47:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3EC30C116D0; Wed, 24 Dec 2025 13:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1766584069; bh=j75MjcSTKE+gPiri9G2CY0WT96U7ncUHjUjFXhcby8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tGDOURCoS9wnchNh8bBRmK5Xp9uCpti/BljOPgRdlojfso+jWz2IkM2AjGVEoifLt sPPMjV5IWQ44apJwBvlMUkKexdGZV3qmo3xS0ttdiNNaNibrlivjtELSGGZjWFMvAO ntYZ+8/4wRZoO29ETd1M1VSnIfZ+Dd3zhRSLRNeZZG1qb6hmarxvHZkX0+PZEtun/2 x4dI/iUUSdIxNI0rmjuNbOMgRhZraLJIwZBdFTnxDGCWJHK3q58YcdD4qfX/sSQtmJ Gtgg3zhr72RTW/I2togXantG3oTBwS09XEgPHISc0Y5aLHOwe41UPrqJwuHSOJPSPU sj/rTUuBVQ3PA== From: Frederic Weisbecker To: LKML Cc: Frederic Weisbecker , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Andrew Morton , Bjorn Helgaas , Catalin Marinas , Chen Ridong , Danilo Krummrich , "David S . Miller" , Eric Dumazet , Gabriele Monaco , Greg Kroah-Hartman , Ingo Molnar , Jakub Kicinski , Jens Axboe , Johannes Weiner , Lai Jiangshan , Marco Crivellari , Michal Hocko , Muchun Song , Paolo Abeni , Peter Zijlstra , Phil Auld , "Rafael J . Wysocki" , Roman Gushchin , Shakeel Butt , Simon Horman , Tejun Heo , Thomas Gleixner , Vlastimil Babka , Waiman Long , Will Deacon , cgroups@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-pci@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 16/33] sched/isolation: Flush vmstat workqueues on cpuset isolated partition change Date: Wed, 24 Dec 2025 14:45:03 +0100 Message-ID: <20251224134520.33231-17-frederic@kernel.org> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251224134520.33231-1-frederic@kernel.org> References: <20251224134520.33231-1-frederic@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251224_055721_460239_A1EFB7A3 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The HK_TYPE_DOMAIN housekeeping cpumask is now modifiable at runtime. In order to synchronize against vmstat workqueue to make sure that no asynchronous vmstat work is still pending or executing on a newly made isolated CPU, the housekeeping susbsystem must flush the vmstat workqueues. This involves flushing the whole mm_percpu_wq workqueue, shared with LRU drain, introducing here a welcome side effect. Signed-off-by: Frederic Weisbecker --- include/linux/vmstat.h | 2 ++ kernel/sched/isolation.c | 1 + kernel/sched/sched.h | 1 + mm/vmstat.c | 5 +++++ 4 files changed, 9 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 3398a345bda8..1909b945b3ea 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -303,6 +303,7 @@ int calculate_pressure_threshold(struct zone *zone); int calculate_normal_threshold(struct zone *zone); void set_pgdat_percpu_threshold(pg_data_t *pgdat, int (*calculate_pressure)(struct zone *)); +void vmstat_flush_workqueue(void); #else /* CONFIG_SMP */ /* @@ -403,6 +404,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 vmstat_flush_workqueue(void) { } static inline void drain_zonestat(struct zone *zone, struct per_cpu_zonestat *pzstats) { } diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index bb6c36d2b97b..8aac3c9f7c7f 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -146,6 +146,7 @@ int housekeeping_update(struct cpumask *isol_mask, enum hk_type type) synchronize_rcu(); mem_cgroup_flush_workqueue(); + vmstat_flush_workqueue(); kfree(old); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 65dfa48e54b7..2d0c408fca0b 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -68,6 +68,7 @@ #include #include #include +#include #include #include #include diff --git a/mm/vmstat.c b/mm/vmstat.c index ed19c0d42de6..d6e814c82952 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -2124,6 +2124,11 @@ static void vmstat_shepherd(struct work_struct *w); static DECLARE_DEFERRABLE_WORK(shepherd, vmstat_shepherd); +void vmstat_flush_workqueue(void) +{ + flush_workqueue(mm_percpu_wq); +} + static void vmstat_shepherd(struct work_struct *w) { int cpu; -- 2.51.1