Commit 69e227e4 authored by Frederic Weisbecker's avatar Frederic Weisbecker
Browse files

mm: vmstat: Prepare to protect against concurrent isolated cpuset change



The HK_TYPE_DOMAIN housekeeping cpumask will soon be made modifiable at
runtime. In order to synchronize against vmstat workqueue to make sure
that no asynchronous vmstat work is pending or executing on a newly made
isolated CPU, target and queue a vmstat work under the same RCU read
side critical section.

Whenever housekeeping will update the HK_TYPE_DOMAIN cpumask, a vmstat
workqueue flush will also be issued in a further change to make sure
that no work remains pending after a CPU has been made isolated.

Acked-by: default avatarMichal Hocko <mhocko@suse.com>
Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
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
parent 2d050686
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2144,11 +2144,13 @@ static void vmstat_shepherd(struct work_struct *w)
		 * infrastructure ever noticing. Skip regular flushing from vmstat_shepherd
		 * for all isolated CPUs to avoid interference with the isolated workload.
		 */
		scoped_guard(rcu) {
			if (cpu_is_isolated(cpu))
				continue;

			if (!delayed_work_pending(dw) && need_update(cpu))
				queue_delayed_work_on(cpu, mm_percpu_wq, dw, 0);
		}

		cond_resched();
	}