[PATCH 04/12] kho: add callback for table pages

Pratyush Yadav pratyush at kernel.org
Mon May 11 09:36:53 PDT 2026


On Mon, May 11 2026, Mike Rapoport wrote:

> On Wed, Apr 29, 2026 at 03:39:06PM +0200, Pratyush Yadav wrote:
>> From: "Pratyush Yadav (Google)" <pratyush at kernel.org>
>> 
>> The KHO memory preservation radix tree does not mark the table pages
>> themselves as scratch. This is done to avoid a circular dependency where
>> preserving a page can lead of allocating other preserved pages. This
>> means any walker looking for free ranges of memory outside of scratch
>> areas will ignore the table
>> 
>> Add a table callback that is invoked for each table page. The callback
>
> A sentence why a table callback helps would be nice here :)

The main reason is that a later patch will create a radix tree for short
use and will need to destroy it afterwards.

Will add that here.

>
>> is given the physical address of the table page.
>> 
>> Signed-off-by: Pratyush Yadav (Google) <pratyush at kernel.org>
>> ---
>>  include/linux/kho_radix_tree.h     |  3 +++
>>  kernel/liveupdate/kexec_handover.c | 12 ++++++++++++
>>  2 files changed, 15 insertions(+)
>> 
>> diff --git a/include/linux/kho_radix_tree.h b/include/linux/kho_radix_tree.h
>> index 030da6399d28..fe7151d89361 100644
>> --- a/include/linux/kho_radix_tree.h
>> +++ b/include/linux/kho_radix_tree.h
>> @@ -37,12 +37,15 @@ struct kho_radix_tree {
>>  /**
>>   * struct kho_radix_walk_cb - Callbacks for KHO radix tree walk.
>>   * @key:      Called on each present key in the radix tree.
>> + * @table:    Called on each table of the radix tree itself. Receives the
>> + *            physical address of the page containing the table.
>>   *
>>   * For each callback, a return value of 0 continues the walk and a non-zero
>>   * return value is directly returned to the caller.
>>   */
>>  struct kho_radix_walk_cb {
>>  	int (*key)(unsigned long key);
>> +	int (*table)(phys_addr_t phys);
>
> Naming is hard ;-)

Yes :-/

>
>>  };
>>  

-- 
Regards,
Pratyush Yadav



More information about the kexec mailing list