lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b216edd6-a794-4407-a6f3-1bf450636a8a@redhat.com>
Date: Thu, 9 Jan 2025 14:13:54 +0100
From: David Hildenbrand <david@...hat.com>
To: Donet Tom <donettom@...ux.ibm.com>,
 Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
 linux-kernel@...r.kernel.org
Cc: Ritesh Harjani <ritesh.list@...il.com>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>,
 "Aneesh Kumar K . V" <aneesh.kumar@...nel.org>,
 Matthew Wilcox <willy@...radead.org>, Zi Yan <ziy@...dia.com>,
 Muchun Song <muchun.song@...ux.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.

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@...ux.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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ