On 16.12.2025 17:55, Oleksii Kurochko wrote:
> Introduce tracking of metadata page entries usage and if all of them are
> p2m_invalid then free them.
> 
> Intermediate P2M page tables are allocated with MEMF_no_owner, so we are free
> to repurpose struct page_info fields for them. Since page_info.u.* is not
> used for such pages, introduce a used_entries counter in struct page_info
> to track how many metadata entries are in use for a given intermediate P2M
> page table.
> 
> The counter is updated in p2m_set_type() when metadata entries transition
> between p2m_invalid and a valid external type. When the last metadata entry
> is cleared (used_entries == 0), the associated metadata page is freed and
> returned to the P2M pool.
> 
> Refactor metadata page freeing into a new helper, p2m_free_metadata_page(),
> as the same logic is needed both when tearing down a P2M table and when
> all metadata entries become p2m_invalid in p2m_set_type(). As part of this
> refactoring, move the declaration of p2m_free_page() earlier to satisfy the
> new helper.
> 
> Additionally, implement page_set_tlbflush_timestamp() for RISC-V instead of
> BUGing, as it is invoked when returning memory to the domheap.
> 
> Suggested-by: Jan Beulich <[email protected]>
> Signed-off-by: Oleksii Kurochko <[email protected]>

Acked-by: Jan Beulich <[email protected]>


Reply via email to