From: Donet Tom <donettom@linux.ibm.com>
To: David Hildenbrand <david@redhat.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 19:59:10 +0530 [thread overview]
Message-ID: <1a384b0d-0548-4340-a664-dffe8fe4cbdc@linux.ibm.com> (raw)
In-Reply-To: <b216edd6-a794-4407-a6f3-1bf450636a8a@redhat.com>
On 1/9/25 18:43, David Hildenbrand wrote:
> 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.
Thank you, David. I understood my patch is wrong.
I have a small question: Page access latency is lower when the folio is
on the same NUMA
node as the process. However, if the policy node is set to a different
NUMA node and the
MPOL_F_MORON flag is not set, we migrate the page to the policy node,
thereby increasing
access latency. Could this have an impact on performance? What benefits
do we gain from this?
next prev parent reply other threads:[~2025-01-09 14:29 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
2025-01-09 14:29 ` Donet Tom [this message]
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=1a384b0d-0548-4340-a664-dffe8fe4cbdc@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