[PATCHv7 07/16] x86/mm: Return correct level from lookup_address() if pte is none
Dave Hansen
dave.hansen at intel.com
Fri Feb 23 10:45:02 PST 2024
On 2/12/24 02:44, Kirill A. Shutemov wrote:
> lookup_address() only returns correct page table level for the entry if
> the entry is not none.
Currently, lookup_address() returns two things:
1. A "pte_t" (which might be a p[g4um]d_t)
2. The 'level' of the page tables where the "pte_t" was found
(returned via a pointer)
If no pte_t is found, 'level' is essentially garbage.
> Make the helper to always return correct 'level'. It allows to implement
> iterator over kernel page tables using lookup_address().
One nit with this description: What's "correct" isn't immediately
obvious to me. It wasn't exactly incorrect before. I think it would be
better to say:
Always fill out the level. For NULL "pte_t"s, fill in the level
where the p*d_none() entry was found mirroring the "found"
behavior.
Always filling out the level allows using lookup_address() to
iterate over kernel page tables.
> Add one more entry into enum pg_level to indicate size of VA covered by
> one PGD entry in 5-level paging mode.
Needs some 'the's:
Add one more entry into enum pg_level to indicate the size of the VA
covered by one PGD entry in 5-level paging mode.
With that fixed:
Reviewed-by: Dave Hansen <dave.hansen at intel.com>
More information about the kexec
mailing list