From: David Hildenbrand <david@redhat.com>
To: Donet Tom <donettom@linux.ibm.com>,
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>,
Muchun Song <muchun.song@linux.dev>
Subject: Re: [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 14:13:54 +0100 [thread overview]
Message-ID: <b216edd6-a794-4407-a6f3-1bf450636a8a@redhat.com> (raw)
In-Reply-To: <20250109064632.898260-1-donettom@linux.ibm.com>
On 09.01.25 07:46, Donet Tom wrote:
> 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;
Doesn't this just mean that it is a local fault, but not necessarily
that we don't want to migrate that folio?
mpol_misplaced states: "check whether current folio node is valid in policy"
Could we have a different policy set that does not indicate the local
node as the target node?
Note how mpol_misplaced() obtains the target node to the do
int curnid = folio_nid(folio);
...
int polnid = NUMA_NO_NODE;
int ret = NUMA_NO_NODE
... detect polnid
if (curnid != polnid)
ret = polnid;
...
return ret;
So mpol_misplaced() will return "NUMA_NO_NODE" if already on the correct
target node.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-01-09 13:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 6:46 Donet Tom
2025-01-09 13:13 ` David Hildenbrand [this message]
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=b216edd6-a794-4407-a6f3-1bf450636a8a@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=donettom@linux.ibm.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