[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7c6d427a-9fe4-4af0-93c8-18ecb2296e36@amd.com>
Date: Wed, 11 Feb 2026 21:10:23 +0530
From: Bharata B Rao <bharata@....com>
To: <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>
CC: <Jonathan.Cameron@...wei.com>, <dave.hansen@...el.com>,
<gourry@...rry.net>, <mgorman@...hsingularity.net>, <mingo@...hat.com>,
<peterz@...radead.org>, <raghavendra.kt@....com>, <riel@...riel.com>,
<rientjes@...gle.com>, <sj@...nel.org>, <weixugc@...gle.com>,
<willy@...radead.org>, <ying.huang@...ux.alibaba.com>, <ziy@...dia.com>,
<dave@...olabs.net>, <nifan.cxl@...il.com>, <xuezhengchu@...wei.com>,
<yiannis@...corp.com>, <akpm@...ux-foundation.org>, <david@...hat.com>,
<byungchul@...com>, <kinseyho@...gle.com>, <joshua.hahnjy@...il.com>,
<yuanchu@...gle.com>, <balbirs@...dia.com>, <alok.rathore@...sung.com>,
<shivankg@....com>
Subject: Re: [RFC PATCH v5 03/10] mm: Hot page tracking and promotion
On 29-Jan-26 8:10 PM, Bharata B Rao 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 {
> + int nid = NUMA_NO_NODE, nr = 1;
> + int freq = 0;
> + unsigned long time = 0;
> +
> + 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))
> + goto out_next;
> +
> + if (nid == NUMA_NO_NODE)
> + nid = pghot_target_nid;
> +
> + if (folio_nid(folio) == nid)
> + goto out_next;
> +
> + if (migrate_misplaced_folio_prepare(folio, NULL, nid))
> + goto out_next;
We should hold a folio reference before the above call which will isolate the
folio from LRU. Otherwise we may hit
VM_BUG_ON_FOLIO(!folio_ref_count(folio), folio)
in folio_isolate_lru().
I hit this only when running Graph500 benchmark and have fixed it in
the github at: https://github.com/AMDESE/linux-mm/tree/bharata/pghot-rfcv6-pre
The numbers that I have posted for micro-benchmarks and redis-memtier are
without this fix while Graph500 numbers are with this fix.
Regards,
Bharata.
Powered by blists - more mailing lists