Re: [PATCH v2 1/3] mm: khugepaged: fix swap entry value to folio_pfn()
From: David Hildenbrand (Arm)
Date: Mon Aug 17 2026 - 12:19:33 EST
> I mean maybe better to just reduce this to something like:
>
> /* folio is NULL unless exited early. */
> trace_mm_khugepaged_scan_file(mm,
> (!folio || xa_is_value(folio)) ? -1 : folio_pfn(folio),
> file, present, swap, result);
>
> As the least invasive way of fixing the trace + limiting the contageon?
I raised that using a folio after dropping relevant refs+locks is in general an
anti-pattern (IOW wrong if folios can just get split afterwards and are suddenly
no longer folios).
I'd like us to avoid that where possible (and suspect Willy will thank us later ;) )
Isn't there some minimal way to just calculate the pfn once we obtain a folio? I
was assuming that there should be an easier way to do that.
--
Cheers,
David