]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched/isolation: Flush vmstat workqueues on cpuset isolated partition change
authorFrederic Weisbecker <frederic@kernel.org>
Fri, 13 Jun 2025 12:48:31 +0000 (14:48 +0200)
committerFrederic Weisbecker <frederic@kernel.org>
Tue, 3 Feb 2026 14:23:34 +0000 (15:23 +0100)
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 <frederic@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Marco Crivellari <marco.crivellari@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Waiman Long <longman@redhat.com>
Cc: linux-mm@kvack.org
include/linux/vmstat.h
kernel/sched/isolation.c
kernel/sched/sched.h
mm/vmstat.c

index 3398a345bda89e31a087a82ad2d6eb7c9f40cb5f..1909b945b3eafcb8723400631978967a9f34ac26 100644 (file)
@@ -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) { }
index f4053ebf4027649f78e7d7b1bace950b27ab11f8..160b3fcab209fec1852bc3f6662bbf20a70e396f 100644 (file)
@@ -145,6 +145,7 @@ int housekeeping_update(struct cpumask *isol_mask)
        synchronize_rcu();
 
        mem_cgroup_flush_workqueue();
+       vmstat_flush_workqueue();
 
        kfree(old);
 
index 65dfa48e54b7874247c1fd3cf14afff2a55c903c..2d0c408fca0b2cc6a3355ac2f1a8f42816cc7e8a 100644 (file)
@@ -68,6 +68,7 @@
 #include <linux/types.h>
 #include <linux/u64_stats_sync_api.h>
 #include <linux/uaccess.h>
+#include <linux/vmstat.h>
 #include <linux/wait_api.h>
 #include <linux/wait_bit.h>
 #include <linux/workqueue_api.h>
index ed19c0d42de621d699d5e8e73096dc90cf1cf688..d6e814c82952a2caf094300fdee93ea2e7bc54cf 100644 (file)
@@ -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;