[PATCH v7 0/3] kho: add support for deferred struct page init

Michal Clapinski posted 3 patches 2 weeks, 1 day ago
include/linux/kexec_handover.h              |  6 ++
include/linux/memblock.h                    |  2 -
kernel/liveupdate/Kconfig                   |  2 -
kernel/liveupdate/Makefile                  |  1 -
kernel/liveupdate/kexec_handover.c          | 65 ++++++++++++++++++---
kernel/liveupdate/kexec_handover_debug.c    | 25 --------
kernel/liveupdate/kexec_handover_internal.h |  7 ++-
mm/memblock.c                               | 22 -------
mm/page_alloc.c                             |  7 +++
9 files changed, 74 insertions(+), 63 deletions(-)
delete mode 100644 kernel/liveupdate/kexec_handover_debug.c
[PATCH v7 0/3] kho: add support for deferred struct page init
Posted by Michal Clapinski 2 weeks, 1 day ago
When CONFIG_DEFERRED_STRUCT_PAGE_INIT (hereinafter DEFERRED) is
enabled, struct page initialization is deferred to parallel kthreads
that run later in the boot process.

Currently, KHO is incompatible with DEFERRED.
This series fixes that incompatibility.
---
v7:
- reimplemented the initialization of kho scratch again
v6:
- reimplemented the initialization of kho scratch
v5:
- rebased
v4:
- added a new commit to fix deferred init of kho scratch
- switched to ulong when refering to pfn
v3:
- changed commit msg
- don't invoke early_pfn_to_nid if CONFIG_DEFERRED_STRUCT_PAGE_INIT=n
v2:
- updated a comment

I took Evangelos's test code:
https://git.infradead.org/?p=users/vpetrog/linux.git;a=shortlog;h=refs/heads/kho-deferred-struct-page-init
and then modified it to this monster test that does 2 allocations:
at core_initcall (early) and at module_init (late). Then kexec, then
2 more allocations at these points, then restore the original 2, then
kexec, then restore the other 2. Basically I test preservation of early
and late allocation both on cold and on warm boot.
Tested it both with and without DEFERRED.

Evangelos Petrongonas (1):
  kho: make preserved pages compatible with deferred struct page init

Michal Clapinski (2):
  kho: make kho_scratch_overlap usable outside debugging
  kho: fix deferred init of kho scratch

 include/linux/kexec_handover.h              |  6 ++
 include/linux/memblock.h                    |  2 -
 kernel/liveupdate/Kconfig                   |  2 -
 kernel/liveupdate/Makefile                  |  1 -
 kernel/liveupdate/kexec_handover.c          | 65 ++++++++++++++++++---
 kernel/liveupdate/kexec_handover_debug.c    | 25 --------
 kernel/liveupdate/kexec_handover_internal.h |  7 ++-
 mm/memblock.c                               | 22 -------
 mm/page_alloc.c                             |  7 +++
 9 files changed, 74 insertions(+), 63 deletions(-)
 delete mode 100644 kernel/liveupdate/kexec_handover_debug.c

-- 
2.53.0.851.ga537e3e6e9-goog
Re: [PATCH v7 0/3] kho: add support for deferred struct page init
Posted by Mike Rapoport 2 weeks, 1 day ago
Hi Michal,

On Tue, Mar 17, 2026 at 03:15:31PM +0100, Michal Clapinski wrote:
> When CONFIG_DEFERRED_STRUCT_PAGE_INIT (hereinafter DEFERRED) is
> enabled, struct page initialization is deferred to parallel kthreads
> that run later in the boot process.
> 
> Currently, KHO is incompatible with DEFERRED.
> This series fixes that incompatibility.
> ---
> v7:
> - reimplemented the initialization of kho scratch again
> v6:
> - reimplemented the initialization of kho scratch
> v5:
> - rebased
> v4:
> - added a new commit to fix deferred init of kho scratch
> - switched to ulong when refering to pfn
> v3:
> - changed commit msg
> - don't invoke early_pfn_to_nid if CONFIG_DEFERRED_STRUCT_PAGE_INIT=n
> v2:
> - updated a comment
> 
> I took Evangelos's test code:
> https://git.infradead.org/?p=users/vpetrog/linux.git;a=shortlog;h=refs/heads/kho-deferred-struct-page-init
> and then modified it to this monster test that does 2 allocations:
> at core_initcall (early) and at module_init (late). Then kexec, then
> 2 more allocations at these points, then restore the original 2, then
> kexec, then restore the other 2. Basically I test preservation of early
> and late allocation both on cold and on warm boot.
> Tested it both with and without DEFERRED.
> 
> Evangelos Petrongonas (1):
>   kho: make preserved pages compatible with deferred struct page init
> 
> Michal Clapinski (2):
>   kho: make kho_scratch_overlap usable outside debugging
>   kho: fix deferred init of kho scratch
> 
>  include/linux/kexec_handover.h              |  6 ++
>  include/linux/memblock.h                    |  2 -
>  kernel/liveupdate/Kconfig                   |  2 -
>  kernel/liveupdate/Makefile                  |  1 -
>  kernel/liveupdate/kexec_handover.c          | 65 ++++++++++++++++++---
>  kernel/liveupdate/kexec_handover_debug.c    | 25 --------
>  kernel/liveupdate/kexec_handover_internal.h |  7 ++-
>  mm/memblock.c                               | 22 -------
>  mm/page_alloc.c                             |  7 +++

Although it's a small change, page_alloc maintainers should be CC'ed
Adding them now.

>  9 files changed, 74 insertions(+), 63 deletions(-)
>  delete mode 100644 kernel/liveupdate/kexec_handover_debug.c
> 
> -- 
> 2.53.0.851.ga537e3e6e9-goog
> 

-- 
Sincerely yours,
Mike.
Re: [PATCH v7 0/3] kho: add support for deferred struct page init
Posted by Andrew Morton 2 weeks, 1 day ago
On Tue, 17 Mar 2026 15:15:31 +0100 Michal Clapinski <mclapinski@google.com> wrote:

> When CONFIG_DEFERRED_STRUCT_PAGE_INIT (hereinafter DEFERRED) is
> enabled, struct page initialization is deferred to parallel kthreads
> that run later in the boot process.
> 
> Currently, KHO is incompatible with DEFERRED.
> This series fixes that incompatibility.

Thanks, I've added this series to mm.git's mm-new branch for testing. 
All being well I'll move it into the mm-unstable branch (and hence
linux-next) in a few days.  All being well I'll move it into the
non-rebasing mm-stable branch a few weeks hence.  Then into mainline
during the merge window!

[1/3] and [2/3] aren't showing any review at this time, but the
well-reviewed [3/3] is the meat of this series.
Re: [PATCH v7 0/3] kho: add support for deferred struct page init
Posted by Mike Rapoport 2 weeks, 1 day ago
On Tue, Mar 17, 2026 at 10:46:25AM -0700, Andrew Morton wrote:
> On Tue, 17 Mar 2026 15:15:31 +0100 Michal Clapinski <mclapinski@google.com> wrote:
> 
> > When CONFIG_DEFERRED_STRUCT_PAGE_INIT (hereinafter DEFERRED) is
> > enabled, struct page initialization is deferred to parallel kthreads
> > that run later in the boot process.
> > 
> > Currently, KHO is incompatible with DEFERRED.
> > This series fixes that incompatibility.
> 
> Thanks, I've added this series to mm.git's mm-new branch for testing. 
> All being well I'll move it into the mm-unstable branch (and hence
> linux-next) in a few days.  All being well I'll move it into the
> non-rebasing mm-stable branch a few weeks hence.  Then into mainline
> during the merge window!
> 
> [1/3] and [2/3] aren't showing any review at this time, but the

They keep changing because of review comments, that's why there still no
tags for them,

> well-reviewed [3/3] is the meat of this series.

-- 
Sincerely yours,
Mike.