|
|
Log in / Subscribe / Register

kho: add support for preserving vmalloc allocations

From:  Mike Rapoport <rppt-AT-kernel.org>
To:  Andrew Morton <akpm-AT-linux-foundation.org>
Subject:  [PATCH v4 0/4] kho: add support for preserving vmalloc allocations
Date:  Wed, 17 Sep 2025 20:40:29 +0300
Message-ID:  <20250917174033.3810435-1-rppt@kernel.org>
Cc:  Alexander Graf <graf-AT-amazon.com>, Baoquan He <bhe-AT-redhat.com>, Changyuan Lyu <changyuanl-AT-google.com>, Chris Li <chrisl-AT-kernel.org>, Jason Gunthorpe <jgg-AT-nvidia.com>, Mike Rapoport <rppt-AT-kernel.org>, Pasha Tatashin <pasha.tatashin-AT-soleen.com>, Pratyush Yadav <pratyush-AT-kernel.org>, kexec-AT-lists.infradead.org, linux-mm-AT-kvack.org, linux-kernel-AT-vger.kernel.org
Archive-link:  Article

From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>

Hi,

Following the discussion about preservation of memfd with LUO [1] these
patches add support for preserving vmalloc allocations.

Any KHO uses case presumes that there's a data structure that lists
physical addresses of preserved folios (and potentially some additional
metadata). Allowing vmalloc preservations with KHO allows scalable
preservation of such data structures.

For instance, instead of allocating array describing preserved folios in
the fdt, memfd preservation can use vmalloc:

        preserved_folios = vmalloc_array(nr_folios, sizeof(*preserved_folios));
        memfd_luo_preserve_folios(preserved_folios, folios, nr_folios);
        kho_preserve_vmalloc(preserved_folios, &folios_info);

[1] https://lore.kernel.org/all/20250807014442.3829950-30-pas...

v4 changes:
* rebase on mm-stable
* use 'struct kho_vmalloc' as preservation metadata instead of storing it in the first chunk
* separate KHO flags from VM_ flags
* unreserve vmalloc pages on error
* add checks for under- and overflow of preserved metadata

v3: https://lore.kernel.org/all/20250908103528.2179934-1-rppt...
* rebase on mm-unstable

v2: https://lore.kernel.org/all/20250905131302.3595582-1-rppt...
* support preservation of vmalloc backed by large pages
* add check for supported vmalloc flags and preserve the flags to be
  able to identify incompatible preservations
* don't use kho_preserve_phys()
* add kernel-doc

v1: https://lore.kernel.org/all/20250903063018.3346652-1-rppt...

Mike Rapoport (Microsoft) (4):
  kho: check if kho is finalized in __kho_preserve_order()
  kho: replace kho_preserve_phys() with kho_preserve_pages()
  kho: add support for preserving vmalloc allocations
  lib/test_kho: use kho_preserve_vmalloc instead of storing addresses in fdt

 include/linux/kexec_handover.h |  26 ++-
 kernel/kexec_handover.c        | 324 ++++++++++++++++++++++++++++-----
 lib/test_kho.c                 |  41 +++--
 mm/memblock.c                  |   4 +-
 4 files changed, 337 insertions(+), 58 deletions(-)


base-commit: 103e90626d3a4032d22e8b09ff14600e71cda59c
--
2.50.1



Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds