linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Donet Tom <donettom@linux.ibm.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Ritesh Harjani <ritesh.list@gmail.com>,
	Baolin Wang <baolin.wang@linux.alibaba.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
	Matthew Wilcox <willy@infradead.org>, Zi Yan <ziy@nvidia.com>,
	David Hildenbrand <david@redhat.com>,
	Muchun Song <muchun.song@linux.dev>
Subject: [PATCH] mm/memory.c: Add return NUMA_NO_NODE in numa_migrate_check() when folio_nid() and numa_node_id() are the same.
Date: Thu,  9 Jan 2025 00:46:32 -0600	[thread overview]
Message-ID: <20250109064632.898260-1-donettom@linux.ibm.com> (raw)

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



             reply	other threads:[~2025-01-09  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09  6:46 Donet Tom [this message]
2025-01-09 13:13 ` David Hildenbrand
2025-01-09 14:29   ` Donet Tom
2025-01-09 14:40     ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250109064632.898260-1-donettom@linux.ibm.com \
    --to=donettom@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=ritesh.list@gmail.com \
    --cc=willy@infradead.org \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox