From: Donet Tom <donettom@linux.ibm.com>
To: Gregory Price <gourry@gourry.net>
Cc: Bharata B Rao <bharata@amd.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Jonathan.Cameron@huawei.com, dave.hansen@intel.com,
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@redhat.com, byungchul@sk.com,
kinseyho@google.com, joshua.hahnjy@gmail.com, yuanchu@google.com,
balbirs@nvidia.com, alok.rathore@samsung.com, shivankg@amd.com
Subject: Re: [RFC PATCH v6 3/5] mm: Hot page tracking and promotion - pghot
Date: Fri, 24 Apr 2026 21:10:33 +0530 [thread overview]
Message-ID: <e49b4d8f-258a-43d5-af2c-9f4e94683ca5@linux.ibm.com> (raw)
In-Reply-To: <aetuZQFtb2dR50cv@gourry-fedora-PF4VCD3F>
[-- Attachment #1: Type: text/plain, Size: 2943 bytes --]
Hi Gregory
On 4/24/26 6:51 PM, Gregory Price wrote:
> On Fri, Apr 24, 2026 at 06:27:02PM +0530, Donet Tom wrote:
>>> +
>>> + /*
>>> + * Record only accesses from lower tiers.
>>> + */
>>> + if (node_is_toptier(pfn_to_nid(pfn)))
>>> + return 0;
>>
>> Just a thought—could we check this at the beginning of the function, before
>> the switch case?
>>
>>
> Can you please trim responses to omit un-related code? Not all of us use
> mail clients that auto-collapse quoted regions and it takes a lot of
> scrolling to reach here n_n;;;
Apologies for that, and thanks for pointing it out. I’ll keep the
responses concise and include only the relevant parts going forward.
>
>>> +static void kmigrated_do_work(pg_data_t *pgdat)
>>> +{
>>> + unsigned long section_nr, s_begin, start_pfn;
>>> + struct mem_section *ms;
>>> + int nid;
>>> +
>>> + clear_bit(PGDAT_KMIGRATED_ACTIVATE, &pgdat->flags);
>>> + s_begin = next_present_section_nr(-1);
>>> + for_each_present_section_nr(s_begin, section_nr) {
>>> + start_pfn = section_nr_to_pfn(section_nr);
>>
>> I may be missing something, but in pghot_setup_hot_map() and
>> kmigrated_do_work() we seem to iterate over all memory sections. On large
>> memory systems, could this become a bottleneck right?
>>
> I think this is going to end up being a function of page / section size.
>
> I would hesitate to over-optimize on this early-on, otherwise we'll find
Sure.
> ourselves re-building a bunch of DAMON functionality that chunks memory
> into regions and such.
>
> But it is a concern.
>
>> Since hot_map is allocated only for lower-tier memory and the hotness
>> information is primarily used there, would it make sense to skip scanning
>> higher-tier sections?
>>
>> for_each_online_node(nid) {
>> if (node_is_toptier(nid))
>> continue;
>>
>> start_pfn = node_start_pfn(nid);
>> end_pfn = node_end_pfn(nid);
>>
>> s_begin = pfn_to_section_nr(start_pfn);
>> for_each_present_section_nr(s_begin, section_nr) {
>> }
>> }
>>
>> Would this approach be reasonable, or am I overlooking something?
>>
> re: your note later on - kmigrated doesn't run for top tier nodes
>
> kmigrated_run() { if (node_is_toptier(nid)) return 0; }
>
>>> +
>>> +static int kmigrated_run(int nid)
>>> +{
>>> + pg_data_t *pgdat = NODE_DATA(nid);
>>> + int ret;
>>> +
>>> + if (node_is_toptier(nid))
>>> + return 0;
>> I might be missing something, but since this function is only called from
>> pghot_init(), would it make sense to check the condition before calling
>> kmigrated_run() to avoid the function call overhead?
>>
> this gets optimized out when static is inlined and optimized.
>
Thanks, Gregory.
I might be missing something, but since kmigrated_run() is not marked
inline (static int kmigrated_run()), will it still be optimized or
inlined by the compiler without the inline keyword?- Donet
>
> ~Gregory
>
[-- Attachment #2: Type: text/html, Size: 4782 bytes --]
next prev parent reply other threads:[~2026-04-24 15:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 9:50 [RFC PATCH v6 0/5] mm: Hot page tracking and promotion infrastructure Bharata B Rao
2026-03-23 9:51 ` [RFC PATCH v6 1/5] mm: migrate: Allow misplaced migration without VMA Bharata B Rao
2026-03-23 9:51 ` [RFC PATCH v6 2/5] mm: migrate: Add migrate_misplaced_folios_batch() Bharata B Rao
2026-03-26 5:50 ` Bharata B Rao
2026-04-21 15:25 ` Donet Tom
2026-04-21 16:05 ` Gregory Price
2026-04-22 3:26 ` Bharata B Rao
2026-04-22 3:37 ` Gregory Price
2026-04-22 4:04 ` Donet Tom
2026-04-22 4:15 ` Bharata B Rao
2026-03-23 9:51 ` [RFC PATCH v6 3/5] mm: Hot page tracking and promotion - pghot Bharata B Rao
2026-04-24 12:57 ` Donet Tom
2026-04-24 13:21 ` Gregory Price
2026-04-24 15:40 ` Donet Tom [this message]
2026-04-27 5:24 ` Bharata B Rao
2026-04-30 7:06 ` Donet Tom
2026-03-23 9:51 ` [RFC PATCH v6 4/5] mm: pghot: Precision mode for pghot Bharata B Rao
2026-03-26 10:41 ` Bharata B Rao
2026-03-23 9:51 ` [RFC PATCH v6 5/5] mm: sched: move NUMA balancing tiering promotion to pghot Bharata B Rao
2026-03-30 4:46 ` Bharata B Rao
2026-03-23 9:56 ` [RFC PATCH v6 0/5] mm: Hot page tracking and promotion infrastructure Bharata B Rao
2026-03-23 9:58 ` Bharata B Rao
2026-03-23 9:59 ` Bharata B Rao
2026-03-23 10:01 ` Bharata B Rao
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=e49b4d8f-258a-43d5-af2c-9f4e94683ca5@linux.ibm.com \
--to=donettom@linux.ibm.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alok.rathore@samsung.com \
--cc=balbirs@nvidia.com \
--cc=bharata@amd.com \
--cc=byungchul@sk.com \
--cc=dave.hansen@intel.com \
--cc=dave@stgolabs.net \
--cc=david@redhat.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