linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/memory.c: Add return NUMA_NO_NODE in numa_migrate_check() when folio_nid() and numa_node_id() are the same.
@ 2025-01-09  6:46 Donet Tom
  2025-01-09 13:13 ` David Hildenbrand
  0 siblings, 1 reply; 4+ messages in thread
From: Donet Tom @ 2025-01-09  6:46 UTC (permalink / raw)
  To: Andrew Morton, linux-mm, linux-kernel
  Cc: Ritesh Harjani, Baolin Wang, Aneesh Kumar K . V, Matthew Wilcox,
	Zi Yan, David Hildenbrand, Muchun Song

If the folio_nid() and numa_node_id() are the same, it indicates
that the folio is already on the same node as the process. In
this case, there's no need to migrate the pages.

This patch adds return NUMA_NO_NODE in numa_migrate_check() when
the folio_nid() and numa_node_id() match, preventing the function
from executing the remaining code unnecessarily.

Signed-off-by: Donet Tom <donettom@linux.ibm.com>
---
 mm/memory.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/memory.c b/mm/memory.c
index 398c031be9ba..dfd89ff7f639 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5509,6 +5509,7 @@ int numa_migrate_check(struct folio *folio, struct vm_fault *vmf,
 	if (folio_nid(folio) == numa_node_id()) {
 		count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);
 		*flags |= TNF_FAULT_LOCAL;
+		return NUMA_NO_NODE;
 	}
 
 	return mpol_misplaced(folio, vmf, addr);
-- 
2.43.5



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

end of thread, other threads:[~2025-01-09 14:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-09  6:46 [PATCH] mm/memory.c: Add return NUMA_NO_NODE in numa_migrate_check() when folio_nid() and numa_node_id() are the same Donet Tom
2025-01-09 13:13 ` David Hildenbrand
2025-01-09 14:29   ` Donet Tom
2025-01-09 14:40     ` David Hildenbrand

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