From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5043C43F4CD for ; Thu, 30 Jul 2026 17:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785433939; cv=none; b=s6WjppkZyYCdpDGF3NmOXs3VmHQPmLGRT+CfeWYEXsffoCaPrAtYZq02qdoDgEsMXpf/AfFnQuVV79AfIGCHiunvZ7hgqebzRRuxMnrcj3cnMqb54LvgMBFYSwu2pzERWOkEoWomLvjJPRd6wADZo5o2KxAirPM0wvC0dxdfIHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785433939; c=relaxed/simple; bh=oRm+zQfL3ytgexnpMJVn4VT5ozqm3aBXlPkah+3sc9A=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=tqpIhdFqdbpMgryvZh2BDFZxZPgTtqoFjC7vH71B1E6nJwVjlrYOVv8EuYzNiroljafAqwkdFvWI7wtkDKX6pKh5txIWkZYmj4L5Htovf4NNeWUbYFwD8GZjDUbsBCg5OXx0qr1oXTZY476PNaee6nSyHbaqPDD32X5I3ePu8rY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--pohaosu.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=JBEoZ9xV; arc=none smtp.client-ip=209.85.214.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--pohaosu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="JBEoZ9xV" Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2cc86a9ef97so629065ad.3 for ; Thu, 30 Jul 2026 10:52:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1785433938; x=1786038738; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date:from :to:cc:subject:date:message-id:reply-to:content-type; bh=wO7RB765UzxGhozrPxhqlAJdRaTFOwvejaaaTpuzVTE=; b=JBEoZ9xVnI1WcFt7gDKZu24rxILTQjeECQM+sum8U1ySqref5l5QJu+TS7en7/a0Gn 5ju8k3J9fbz1SBHqHO8PcuRfkRLlHaDZmOjUFornm9FpF78uk7+UbL2m/bVE7fGYvlPP QCmqXG9uA6r++r7YDBuHmRXz1OBQ/MFhS08S1X5L+8HMj8ZDKZtP6btukA/6rR0CIhwS OFHCuCV4RT4Ojts+X5guTJ5UTTeZz56tRZQ97P+98UOCUzrkFWQr5HoQesIOWvmOi9PF ors5N34dXgNoYaCkODAxLwU9ECKdrjQMnuN6fn+KvyxHbN9D3mSleETGoP58cpwku41L Yh/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785433938; x=1786038738; h=content-type:cc:to:from:subject:message-id:mime-version:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=wO7RB765UzxGhozrPxhqlAJdRaTFOwvejaaaTpuzVTE=; b=m6jK5do19PnccfCMvXWTAviSeE/Rx22lxq5qi3bEeVmKDZzkuvhCVkNVKLHJJd8txr IgSbb+Es9tMTTSKIXKLSn75Ei4K7rm3Zhyhte4AxuFgH77EoSC7qg4PdXJq27Bitb9jT j4Tip98WMWuH/oyuKhQgjwImZKEhEl1bUNqI9xbgM7DFpru9ztMu43GwH+cpnnERSGwp WHnhbrIa42icmWZLjdqRu+60s6+AY6EsTuQ/nzGG4B6e0as7mAp0ng26rv7St/vNaMzA 5IQIhH6Q2Nq+6GSk0l7ynSGFgucyZmvwP+ptkxj2iF7svj2tJplBnTXJTzB24XUr3IXt Ssaw== X-Forwarded-Encrypted: i=1; AHgh+Rp6LwYmQRLHuDXBu+iCbqoRl6TlGFnj10RRapDerT2qn3FxqfWp6ld/hQ8n8TnNuLs7/jHYhSUQvxbZgqY=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1MY1LJvGmJsAKMHJrpJJbwSyrxe5V7zijQWaD9BtwvF50f5He ESv/ZGankIaWIKHHvv2RLcEH6htMc5YQu823T1MWJI/LicfEbFS5QFQ7SU4XR6NXRAG+QTuBVbT cEPa0ncGkLg== X-Received: from plbix1.prod.google.com ([2002:a17:902:f801:b0:2cc:e864:96d7]) (user=pohaosu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:903:1a2b:b0:2ca:ecfa:1308 with SMTP id d9443c01a7336-2d03dcf8cdbmr10528885ad.20.1785433937444; Thu, 30 Jul 2026 10:52:17 -0700 (PDT) Date: Thu, 30 Jul 2026 17:51:51 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.508.g3f0d502094-goog Message-ID: <20260730175151.3855700-1-pohaosu@google.com> Subject: [PATCH] sched/fair: Skip NUMA balancing scan on memoryless nodes From: Phineas Su To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot Cc: Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , linux-kernel@vger.kernel.org, Phineas Su Content-Type: text/plain; charset="UTF-8" On systems with memoryless NUMA nodes (e.g. CPU-only nodes created via memory hiding, socket topologies with unpopulated memory, or CPU-only NUMA nodes), tasks running on these CPUs cause automatic NUMA balancing (kernel.numa_balancing=1) to repeatedly schedule task_numa_work() from task_tick_numa(). When task_numa_work() executes, it unmaps VMAs (PROT_NONE) to induce NUMA hinting faults (do_numa_page()). Fault handling then attempts page migration (migrate_misplaced_folio()) to the task's current CPU NUMA node. However, because the node has no managed memory (N_MEMORY is false), page allocations continuously fail (TNF_MIGRATE_FAIL), while task_tick_numa() repeatedly reschedules VMA scanning every scan period. This results in heavy kernel system overhead (%sys CPU usage spiking up to ~78%) and continuous page fault storms without any possible NUMA placement benefit. Fix this by: 1. Checking node_state(task_node(curr), N_MEMORY) in task_tick_numa() so tasks executing on CPUs of memoryless nodes do not schedule numa_work callbacks via task_work_add(). 2. Checking node_state(task_node(p), N_MEMORY) in task_numa_work() as a safeguard to immediately abort VMA scanning if a task migrated to a memoryless node while numa_work was already enqueued. Signed-off-by: Phineas Su --- kernel/sched/fair.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d78467ec6ee1..214cf0f2c692 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4101,6 +4101,9 @@ static void task_numa_work(struct callback_head *work) if (p->flags & PF_EXITING) return; + if (!node_state(task_node(p), N_MEMORY)) + return; + /* * Memory is pinned to only one NUMA node via cpuset.mems, naturally * no page can be migrated. @@ -4391,6 +4394,9 @@ static void task_tick_numa(struct rq *rq, struct task_struct *curr) if (!curr->mm || (curr->flags & (PF_EXITING | PF_KTHREAD)) || work->next != work) return; + if (!node_state(task_node(curr), N_MEMORY)) + return; + /* * Using runtime rather than walltime has the dual advantage that * we (mostly) drive the selection from busy threads and that the -- 2.55.0.508.g3f0d502094-goog