linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY
@ 2024-02-16 11:40 Byungchul Park
  2024-02-16 13:51 ` Oscar Salvador
  2024-02-19  9:30 ` David Hildenbrand
  0 siblings, 2 replies; 8+ messages in thread
From: Byungchul Park @ 2024-02-16 11:40 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, bristot, vschneid
  Cc: linux-kernel, linux-mm, kernel_team, akpm

Changes from v2:
	1. Rewrite the comment in code and the commit message becasue it
	   turns out that this patch is not the real fix for the oops
	   descriped. The real fix goes in another patch below:

	   https://lore.kernel.org/lkml/20240216111502.79759-1-byungchul@sk.com/

Changes from v1:
	1. Trim the verbose oops in the commit message. (feedbacked by
	   Phil Auld)
	2. Rewrite a comment in code. (feedbacked by Phil Auld)

--->8---
From 150af2f78e19217a1d03e47e3ee5279684590fb4 Mon Sep 17 00:00:00 2001
From: Byungchul Park <byungchul@sk.com>
Date: Fri, 16 Feb 2024 20:18:10 +0900
Subject: [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY

A numa node might not have its local memory but CPUs. Promoting a folio
to the node's local memory is nonsense. So avoid nodes not set N_MEMORY
from getting promoted.

Signed-off-by: Byungchul Park <byungchul@sk.com>
---
 kernel/sched/fair.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d7a3c63a2171..7ed9ef3c0134 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1828,6 +1828,13 @@ bool should_numa_migrate_memory(struct task_struct *p, struct folio *folio,
 	int dst_nid = cpu_to_node(dst_cpu);
 	int last_cpupid, this_cpupid;
 
+	/*
+	 * A node of dst_nid might not have its local memory. Promoting
+	 * a folio to the node is meaningless.
+	 */
+	if (!node_state(dst_nid, N_MEMORY))
+		return false;
+
 	/*
 	 * The pages in slow memory node should be migrated according
 	 * to hot/cold instead of private/shared.
-- 
2.17.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-02-19 19:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-16 11:40 [PATCH v3] sched/numa, mm: do not promote folios to nodes not set N_MEMORY Byungchul Park
2024-02-16 13:51 ` Oscar Salvador
2024-02-18  7:46   ` Oscar Salvador
2024-02-19  2:10     ` Byungchul Park
2024-02-19 19:26     ` Davidlohr Bueso
2024-02-19  2:08   ` Byungchul Park
2024-02-19 15:00     ` Phil Auld
2024-02-19  9:30 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox