[PATCH 03/12] kho: add a struct for radix callbacks
Pratyush Yadav
pratyush at kernel.org
Tue May 12 02:11:19 PDT 2026
On Tue, May 12 2026, Mike Rapoport wrote:
> On Mon, May 11, 2026 at 06:35:54PM +0200, Pratyush Yadav wrote:
>> On Mon, May 11 2026, Mike Rapoport wrote:
>>
>> > On Wed, Apr 29, 2026 at 03:39:05PM +0200, Pratyush Yadav wrote:
>> >> From: "Pratyush Yadav (Google)" <pratyush at kernel.org>
>> >>
>> >> A future commit will add more callbacks for the KHO radix tree. Add a
>> >> struct for collecting the callbacks.
>> >>
>> >> Signed-off-by: Pratyush Yadav (Google) <pratyush at kernel.org>
>> >> ---
>> [...]
>> >> --- a/kernel/liveupdate/kexec_handover.c
>> >> +++ b/kernel/liveupdate/kexec_handover.c
>> >> @@ -266,16 +266,18 @@ void kho_radix_del_key(struct kho_radix_tree *tree, unsigned long key)
>> >> }
>> >> EXPORT_SYMBOL_GPL(kho_radix_del_key);
>> >>
>> >> -static int kho_radix_walk_leaf(struct kho_radix_leaf *leaf,
>> >> - unsigned long key,
>> >> - kho_radix_tree_walk_callback_t cb)
>> >> +static int kho_radix_walk_leaf(struct kho_radix_leaf *leaf, unsigned long key,
>> >> + const struct kho_radix_walk_cb *cb)
>> >> {
>> >> unsigned long *bitmap = (unsigned long *)leaf;
>> >> unsigned int i;
>> >> int err;
>> >>
>> >> + if (!cb->key)
>> >> + return 0;
>> >> +
>> >> for_each_set_bit(i, bitmap, PAGE_SIZE * BITS_PER_BYTE) {
>> >> - err = cb(key | i);
>> >> + err = cb->key(key | i);
>> >
>> > key(key) reads weird :)
>> > Can't say I have a good name, maybe key_action()?
>>
>> I thought the context of it being under a callback struct would make it
>> more obvious. I don't like key_action() much better TBH, but I don't
>> have a strong opinion. Perhaps Pasha can suggest a 3rd option and we
>> pick on randomly ;-)
>
> Another option I thought is to call them ->leaf() and ->node().
This one sounds nice. Will use it in v2.
--
Regards,
Pratyush Yadav
More information about the kexec
mailing list