Re: [RFC PATCH v4 8/9] mm: sched: Move hot page promotion from NUMAB=2 to pghot tracking

From: Bharata B Rao
Date: Thu Jan 01 2026 - 03:56:32 EST


On 22-Dec-25 3:56 PM, Alok Rathore wrote:
<snip>
>> +static bool kmigrated_should_migrate_memory(unsigned long nr_pages, unsigned
>> long nid,
>> +                        unsigned long time)
>> +{
>> +    struct pglist_data *pgdat;
>> +    unsigned long rate_limit;
>> +    unsigned int th, def_th;
>> +    unsigned long now = jiffies;
>
> now = jiffies & PGHOT_TIME_MASK;
>> +    unsigned long now_ms = jiffies_to_msecs(now);
>> +
>> +    pgdat = NODE_DATA(nid);
>> +    if (pgdat_free_space_enough(pgdat)) {
>> +        /* workload changed, reset hot threshold */
>> +        pgdat->nbp_threshold = 0;
>> +        mod_node_page_state(pgdat, PGPROMOTE_CANDIDATE_NRL, nr_pages);
>> +        return true;
>> +    }
>> +
>> +    def_th = sysctl_pghot_freq_window;
>> +    rate_limit = MB_TO_PAGES(sysctl_pghot_promote_rate_limit);
>> +    kmigrated_promotion_adjust_threshold(pgdat, rate_limit, def_th, now_ms);
>> +
>> +    th = pgdat->nbp_threshold ? : def_th;
>> +    if (jiffies_to_msecs(now - time) >= th)
>
> Setting time in pfn hotness using PGHOT_TIME_MASK in pghot_record_access().
> Therefore
> here also it should be calculated using PGHOT_TIME_MASK. Then it'll be right
> comparision.

That's correct, will fix this in next iteration.

Regards,
Bharataa.