[PATCH 2/2] kho: drop restriction on maximum page order

Mike Rapoport rppt at kernel.org
Tue Mar 10 03:33:38 PDT 2026


On Mon, Mar 09, 2026 at 12:34:07PM +0000, Pratyush Yadav wrote:
> KHO currently restricts the maximum order of a restored page to the
> maximum order supported by the buddy allocator. While this works fine
> for much of the data passed across kexec, it is possible to have pages
> larger than MAX_PAGE_ORDER.
> 
> For one, it is possible to get a larger order when using
> kho_preserve_pages() if the number of pages is large enough, since it
> tries to combine multiple aligned 0-order preservations into one higher
> order preservation.
> 
> For another, upcoming support for hugepages can have gigantic hugepages
> being preserved over KHO.
> 
> There is no real reason for this limit. The KHO preservation machinery
> can handle any page order. Remove this artificial restriction on max
> page order.
> 
> Signed-off-by: Pratyush Yadav <pratyush at kernel.org>
> Signed-off-by: Pratyush Yadav (Google) <pratyush at kernel.org>

One SOB should be enough ;-)

Reviewed-by: Mike Rapoport (Microsoft) <rppt at kernel.org>

> ---
> 
> Notes:
>     This patch was first sent with this RFC series [0]. I am sending it
>     separately since it is an independent patch that is useful even without
>     hugepage preservation. No changes since the RFC.
>     
>     [0] https://lore.kernel.org/linux-mm/20251206230222.853493-1-pratyush@kernel.org/T/#u
> 
>  kernel/liveupdate/kexec_handover.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/liveupdate/kexec_handover.c b/kernel/liveupdate/kexec_handover.c
> index bc9bd18294ee..1038e41ff9f9 100644
> --- a/kernel/liveupdate/kexec_handover.c
> +++ b/kernel/liveupdate/kexec_handover.c
> @@ -253,7 +253,7 @@ static struct page *kho_restore_page(phys_addr_t phys, bool is_folio)
>  	 * check also implicitly makes sure phys is order-aligned since for
>  	 * non-order-aligned phys addresses, magic will never be set.
>  	 */
> -	if (WARN_ON_ONCE(info.magic != KHO_PAGE_MAGIC || info.order > MAX_PAGE_ORDER))
> +	if (WARN_ON_ONCE(info.magic != KHO_PAGE_MAGIC))
>  		return NULL;
>  	nr_pages = (1 << info.order);
>  
> -- 
> 2.53.0.473.g4a7958ca14-goog
> 

-- 
Sincerely yours,
Mike.



More information about the kexec mailing list