]> www.infradead.org Git - users/willy/pagecache.git/commit
intel_th: avoid using deprecated page->mapping, index fields
authorLorenzo Stoakes <lorenzo.stoakes@oracle.com>
Tue, 3 Dec 2024 08:00:01 +0000 (08:00 +0000)
committerMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 17 Mar 2025 19:54:16 +0000 (15:54 -0400)
commit56609970619d44535564556653a0b37a713f7933
tree59d1e865a961125f7add89285c144fcf516fbd7f
parente94bd4ec45ac156616da285a0bf03056cd7430fc
intel_th: avoid using deprecated page->mapping, index fields

The struct page->mapping, index fields are deprecated and soon to be only
available as part of a folio.

It is likely the intel_th code which sets page->mapping, index is was
implemented out of concern that some aspect of the page fault logic may
encounter unexpected problems should they not.

However, the appropriate interface for inserting kernel-allocated memory is
vm_insert_page() in a VM_MIXEDMAP. By using the helper function
vmf_insert_mixed() we can do this with minimal churn in the existing fault
handler.

By doing so, we bypass the remainder of the faulting logic. The pages are
still pinned so there is no possibility of anything unexpected being done
with the pages once established.

It would also be reasonable to pre-map everything on fault, however to
minimise churn we retain the fault handler.

We also eliminate all code which clears page->mapping on teardown as this
has now become unnecessary.

The MSU code relies on faulting to function correctly, so is by definition
dependent on CONFIG_MMU. We avoid spurious reports about compilation
failure for unsupported platforms by making this requirement explicit in
Kconfig as part of this change too.

Signed-off-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
drivers/hwtracing/intel_th/Kconfig
drivers/hwtracing/intel_th/msu.c