From: Bharata B Rao <bharata@amd.com>
To: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Cc: <Jonathan.Cameron@huawei.com>, <dave.hansen@intel.com>,
<gourry@gourry.net>, <mgorman@techsingularity.net>,
<mingo@redhat.com>, <peterz@infradead.org>,
<raghavendra.kt@amd.com>, <riel@surriel.com>,
<rientjes@google.com>, <sj@kernel.org>, <weixugc@google.com>,
<willy@infradead.org>, <ying.huang@linux.alibaba.com>,
<ziy@nvidia.com>, <dave@stgolabs.net>, <nifan.cxl@gmail.com>,
<xuezhengchu@huawei.com>, <yiannis@zptcorp.com>,
<akpm@linux-foundation.org>, <david@kernel.org>,
<byungchul@sk.com>, <kinseyho@google.com>,
<joshua.hahnjy@gmail.com>, <yuanchu@google.com>,
<balbirs@nvidia.com>, <alok.rathore@samsung.com>,
<shivankg@amd.com>, <donettom@linux.ibm.com>
Subject: Re: [PATCH v8 5/8] mm: sched: move NUMA balancing tiering promotion to pghot
Date: Mon, 3 Aug 2026 13:53:21 +0530 [thread overview]
Message-ID: <169e55f3-1b39-43fa-b844-747d128e16b1@amd.com> (raw)
In-Reply-To: <20260728054356.291998-6-bharata@amd.com>
[Reply to Shashiko review]
On 28-Jul-26 11:13 AM, Bharata B Rao wrote:
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 2bccb0a53a0a..c36092ebca42 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -41,6 +41,7 @@
> #include <linux/pgalloc.h>
> #include <linux/pgalloc_tag.h>
> #include <linux/pagewalk.h>
> +#include <linux/pghot.h>
>
> #include <asm/tlb.h>
> #include "internal.h"
> @@ -2205,7 +2206,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
> int nid = NUMA_NO_NODE;
> int target_nid, last_cpupid;
> pmd_t pmd, old_pmd;
> - bool writable = false;
> + bool writable = false, needs_promotion = false;
> int flags = 0;
>
> vmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);
> @@ -2232,11 +2233,29 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf)
> goto out_map;
>
> nid = folio_nid(folio);
> + needs_promotion = folio_is_promo_candidate(folio);
>
> target_nid = numa_migrate_check(folio, vmf, haddr, &flags, writable,
> &last_cpupid);
> if (target_nid == NUMA_NO_NODE)
> goto out_map;
> +
> + if (needs_promotion) {
> + /*
> + * Hot page promotion, mode=NUMA_BALANCING_MEMORY_TIERING.
> + *
> + * Isolation and migration are handled by pghot. Since VMA
> + * won't be available to kmigrated which does batched migration
> + * from non-process context, filter shared EXEC pages here itself.
> + */
> + if ((vma->vm_flags & VM_EXEC) && folio_maybe_mapped_shared(folio))
> + nid = NUMA_NO_NODE;
> + else
> + nid = target_nid;
> + goto out_map;
> + }
> Does this drop NUMA fault statistics for shared EXEC pages?
>
> If nid is set to NUMA_NO_NODE here, the out_map path skips task_numa_fault()
> entirely, which seems like it would disrupt scan-period adjustment.
It does drop the call to task_numa_fault() for shared EXEC pages but then
base kernel also has a memory-tiering gate that resulted in shared EXEC pages
not being considered for scan period updates. So this doesn't really drop the
NUMA fault stats for shared exec pages. However I can make it structurally
similar to base so that it is the memory-tiering gate that rejects the
scan period update for shared exec pages.
> Additionally, for non-shared pages, nid is set to target_nid, which might
> prematurely account the fault to the target node before the migration actually
> happens.
Accounting the fault to target node is deliberate here because in pghot the
promotion is delegated to kmigrated. So reporting mem_node=target_nid (top tier)
is what feeds the scan period update in task_numa_fault(). Since pghot does
async migration, it feeds all promo candidates rather than only the successfully
migrated ones like in base.
> diff --git a/mm/memory.c b/mm/memory.c
> index ff338c2abe92..91daba4c2bc9 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -75,6 +75,7 @@
> #include <linux/perf_event.h>
> #include <linux/ptrace.h>
> #include <linux/vmalloc.h>
> +#include <linux/pghot.h>
> #include <linux/sched/sysctl.h>
> #include <linux/pgalloc.h>
> #include <linux/uaccess.h>
> @@ -6029,10 +6030,9 @@ int numa_migrate_check(struct folio *folio, struct vm_fault *vmf,
> if (folio_maybe_mapped_shared(folio) && (vma->vm_flags & VM_SHARED))
> *flags |= TNF_SHARED;
> /*
> - * For memory tiering mode, cpupid of slow memory page is used
> - * to record page access time. So use default value.
> + * For memory tiering mode, last_cpupid is unused. So use default value.
> */
> - if (folio_use_access_time(folio))
> + if (folio_is_promo_candidate(folio))
> *last_cpupid = (-1 & LAST_CPUPID_MASK);
> else
> *last_cpupid = folio_last_cpupid(folio);
> @@ -6113,6 +6113,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> int nid = NUMA_NO_NODE;
> bool writable = false, ignore_writable = false;
> bool pte_write_upgrade = vma_wants_manual_pte_write_upgrade(vma);
> + bool needs_promotion = false;
> int last_cpupid;
> int target_nid;
> pte_t pte, old_pte;
> @@ -6147,12 +6148,30 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
> goto out_map;
>
> nid = folio_nid(folio);
> + needs_promotion = folio_is_promo_candidate(folio);
> nr_pages = folio_nr_pages(folio);
>
> target_nid = numa_migrate_check(folio, vmf, vmf->address, &flags,
> writable, &last_cpupid);
> if (target_nid == NUMA_NO_NODE)
> goto out_map;
> +
> + if (needs_promotion) {
> + /*
> + * Hot page promotion, mode=NUMA_BALANCING_MEMORY_TIERING.
> + *
> + * Isolation and migration are handled by pghot. Since VMA
> + * won't be available to kmigrated which does batched migration
> + * from non-process context, filter shared EXEC pages here itself.
> + */
> + if ((vma->vm_flags & VM_EXEC) && folio_maybe_mapped_shared(folio))
> + nid = NUMA_NO_NODE;
> + else
> + nid = target_nid;
> + goto out_map;
> + }
> Is the same accounting disruption happening here in do_numa_page() as well?
>
> Assigning NUMA_NO_NODE skips task_numa_fault() later in the function, and
> assigning target_nid credits the target node prior to the actual migration.
Reply to this same as above.
The other two comments for this patch actually belong to patch 3/8 and have
been addressed there.
Regards,
Bharata.
next prev parent reply other threads:[~2026-08-03 8:23 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 5:43 [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 1/8] mm: migrate: Allow misplaced migration without VMA Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 2/8] mm: migrate: Add promote_misplaced_memcg_folios() Bharata B Rao
2026-07-30 6:34 ` Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 3/8] mm: Hot page tracking and promotion - pghot Bharata B Rao
2026-07-31 16:14 ` Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 4/8] mm: pghot: Precision mode for pghot Bharata B Rao
2026-07-31 16:27 ` Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 5/8] mm: sched: move NUMA balancing tiering promotion to pghot Bharata B Rao
2026-08-03 8:23 ` Bharata B Rao [this message]
2026-07-28 5:43 ` [PATCH v8 6/8] x86/ibs: Move IBS caps definitions into its own header Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 7/8] x86/mm/ibs: In-kernel driver for AMD IBS Memory Profiler Bharata B Rao
2026-08-04 5:00 ` Bharata B Rao
2026-07-28 5:43 ` [PATCH v8 8/8] x86/mm/ibs: Add runtime controls for IBS memprofiler Bharata B Rao
2026-08-04 5:20 ` Bharata B Rao
2026-07-28 5:55 ` [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure - microbenchmark numbers Bharata B Rao
2026-07-28 5:59 ` [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure - NAS BT Bharata B Rao
2026-07-28 6:02 ` [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure - Graph500 Bharata B Rao
2026-07-28 6:05 ` [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure - redis-memtier Bharata B Rao
2026-07-28 6:17 ` [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure - llama-bench Bharata B Rao
2026-07-28 18:14 ` [PATCH v8 0/8] mm: Hot page tracking and promotion infrastructure Andrew Morton
2026-07-28 18:24 ` Matthew Wilcox
2026-07-28 18:57 ` Gregory Price
2026-07-28 19:20 ` David Hildenbrand (Arm)
2026-07-28 19:59 ` Gregory Price
2026-07-29 11:45 ` Bharata B Rao
2026-08-10 3:38 ` Yongting Lin
2026-08-10 4:16 ` Matthew Wilcox
2026-08-10 5:35 ` Bharata B Rao
2026-08-11 7:15 ` Yongting Lin
2026-08-13 2:21 ` Gregory Price
2026-08-10 14:37 ` SJ Park
2026-08-11 6:37 ` Yongting Lin
2026-07-29 9:35 ` Bharata B Rao
2026-07-29 13:54 ` SJ Park
2026-08-04 1:23 ` SJ Park
2026-08-06 5:49 ` Bharata B Rao
2026-08-06 13:44 ` SJ Park
2026-08-10 4:46 ` Bharata B Rao
2026-08-10 14:25 ` SJ Park
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=169e55f3-1b39-43fa-b844-747d128e16b1@amd.com \
--to=bharata@amd.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alok.rathore@samsung.com \
--cc=balbirs@nvidia.com \
--cc=byungchul@sk.com \
--cc=dave.hansen@intel.com \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=donettom@linux.ibm.com \
--cc=gourry@gourry.net \
--cc=joshua.hahnjy@gmail.com \
--cc=kinseyho@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mingo@redhat.com \
--cc=nifan.cxl@gmail.com \
--cc=peterz@infradead.org \
--cc=raghavendra.kt@amd.com \
--cc=riel@surriel.com \
--cc=rientjes@google.com \
--cc=shivankg@amd.com \
--cc=sj@kernel.org \
--cc=weixugc@google.com \
--cc=willy@infradead.org \
--cc=xuezhengchu@huawei.com \
--cc=yiannis@zptcorp.com \
--cc=ying.huang@linux.alibaba.com \
--cc=yuanchu@google.com \
--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
all inboxes | Powered by JetHome®