[PATCH 01/12] kho: generalize radix tree APIs
Mike Rapoport
rppt at kernel.org
Wed May 13 03:32:32 PDT 2026
On Mon, May 11, 2026 at 06:25:52PM +0200, Pratyush Yadav wrote:
> On Mon, May 11 2026, Mike Rapoport wrote:
>
> > On Wed, Apr 29, 2026 at 03:39:03PM +0200, Pratyush Yadav wrote:
> >> From: "Pratyush Yadav (Google)" <pratyush at kernel.org>
> >>
> >> The KHO radix tree is a data structure that can track the presence or
> >> absence of an arbitrary key, with nothing inherently tied to KHO memory
> >> preservation tracking. This was one of the design goals of the radix
> >> tree. This was done to enable it to be re-used by other users of KHO.
> >>
> >> Despite that, the radix tree APIs are very closely tied to KHO memory
> >> preservation tracking. Adding a key is done by kho_radix_add_page(),
> >> which encodes it as a page tracking operation and takes in PFN and
> >> order. kho_radix_del_page() does the same. These functions encode the
> >> key internally that goes into the radix tree. kho_radix_walk_tree() does
> >> the same by baking the PFN and order into the callback arguments.
> >>
> >> Generalize the APIs by taking the key directly and doing the encoding at
> >> the callers. Rename the functions to kho_radix_add_key() and
> >> kho_radix_del_key(). In practice, this removes a line each from the
> >> functions and moves the encoding function call to the callers.
> >> Similarly, update kho_radix_tree_walk_callback_t to take the key
> >> directly.
> >>
> >> To keep the naming convention clearer, rename
> >> kho_radix_{encode,decode}_key() to kho_{encode,decode}_radix_key().
> >>
> >> Signed-off-by: Pratyush Yadav (Google) <pratyush at kernel.org>
> >> ---
> >> include/linux/kho_radix_tree.h | 18 +++----
> >> kernel/liveupdate/kexec_handover.c | 76 ++++++++++++++----------------
> >> 2 files changed, 42 insertions(+), 52 deletions(-)
> >>
> >> diff --git a/include/linux/kho_radix_tree.h b/include/linux/kho_radix_tree.h
> >> index 84e918b96e53..f368f3b9f923 100644
> >> --- a/include/linux/kho_radix_tree.h
> >> +++ b/include/linux/kho_radix_tree.h
> >> @@ -85,7 +85,7 @@ static struct kho_out kho_out = {
> >> };
> >>
> >> /**
> >> - * kho_radix_encode_key - Encodes a physical address and order into a radix key.
> >> + * kho_encode_radix_key - Encodes a physical address and order into a radix key.
> >
> > Let's keep kho_radix_ prefix for namespasing please.
> > This is the common practice these days.
>
> I am keeping the namespacing, just moving it out of the "kho_radix"
> namespace to "kho" namespace. The mental model is that this function has
> nothing to do with the radix tree. It is just something KHO uses for one
> of its radix tree, so it should live in the "kho" namespace not
> "kho_radix".
>
> Does that make sense? I can add this explanation to the commit message
> as well.
With this explanation it makes sense, with "to keep the naming convention
clearer" it felt the opposite :)
> --
> Regards,
> Pratyush Yadav
--
Sincerely yours,
Mike.
More information about the kexec
mailing list