Re: [RFC PATCH v3 3/8] mm: Hot page tracking and promotion
From: Bharata B Rao
Date: Sat Dec 06 2025 - 05:22:21 EST
On 26-Nov-25 6:54 PM, Alok Rathore wrote:
>> +/*
>> + * Walks the PFNs of the zone, isolates and migrates them in batches.
>> + */
>> +static void kmigrated_walk_zone(unsigned long start_pfn, unsigned long end_pfn,
>> + int src_nid)
>> +{
>> + int cur_nid = NUMA_NO_NODE;
>> + LIST_HEAD(migrate_list);
>> + int batch_count = 0;
>> + struct folio *folio;
>> + struct page *page;
>> + unsigned long pfn;
>> +
>> + pfn = start_pfn;
>> + do {
>> + unsigned long nid = NUMA_NO_NODE, freq = 0, time = 0, nr = 1;
>> +
>> + if (!pfn_valid(pfn))
>> + goto out_next;
>> +
>> + page = pfn_to_online_page(pfn);
>> + if (!page)
>> + goto out_next;
>> +
>> + folio = page_folio(page);
>> + nr = folio_nr_pages(folio);
>> + if (folio_nid(folio) != src_nid)
>> + goto out_next;
>> +
>> + if (!folio_test_lru(folio))
>> + goto out_next;
>> +
>> + if (pghot_get_hotness(pfn, &nid, &freq, &time))
>
> Better to remove freq value, it’s not used later.
Yes, can be removed. I am leaving it here just for a future possibility
of having kmigrated being driven to migrate hottest pages on priority
compared to hot pages at which point frequency value may come in handy.
Regards,
Bharata.