[PATCH v3 02/21] kho: make radix max key width more obvious
Mike Rapoport
rppt at kernel.org
Wed Jul 15 02:35:19 PDT 2026
> The KHO radix tree constants are somewhat hard to understand. The tree
> depth essentially comes from the max key width. The max key width comes
> from the need to store a 52-bit PFN plus one more bit for the order.
>
> All this is very obscure with the corrent code. The PFN width is defined
> as KHO_ORDER_0_LOG2, which makes very little sense to a new reader not
> already familiar with what the value means. Then the fact that an extra
> bit is needed is hidden in the KHO_TREE_MAX_DEPTH calculation.
>
> Simplify this by removing KHO_ORDER_0_LOG2 and replace it with
> KHO_RADIX_KEY_WIDTH. Update the comment to explain why this value is
> used. This moves the +1 from KHO_TREE_MAX_DEPTH to KHO_RADIX_KEY_WIDTH,
> making things clearer.
>
> Update kho_{encode,decode}_radix_key() to not use KHO_ORDER_0_LOG2.
> Instead, refactor the code and comments to make it clearer how the
> encoding and decoding is done.
>
> In kho_encode_radix_key(), add a new variable for the shift for phys.
Nit: physical address ^
--
Sincerely yours,
Mike.
More information about the kexec
mailing list