Skip to content

kho: free buddy-allocated metadata with free_page()

Federico Parola kexec linux-mm stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2kho: free chunks using free_page() instead of kfree()kernel/kexec_handover.c+1 -10 replies
2/2kho: free phys_bits bitmaps using free_page() in __kho_abort()kernel/kexec_handover.c+1 -12 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchPasha TatashinMike Rapoport (Microsoft)
1/2R-b R-b
2/2A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 6.18.y 0/2] kho: free buddy-allocated metadata with free_page()

Commit fa759cd75bce ("kho: allocate metadata directly from the buddy allocator"), merged in 6.18, moved the KHO serialization chunks and the preserved memory bitmaps from kzalloc() to get_zeroed_page(). Two places still release them with kfree(): kho_mem_ser_free() for the chunks and __kho_abort() for the bitmaps. kfree() on such a page hits the WARN_ON_ONCE() in free_large_kmalloc() and returns without freeing it, so each aborted or failed KHO finalization leaks the metadata pages.

Patch 1 is a clean backport of the upstream fix for the chunks.

Patch 2 fixes the bitmaps and has no upstream counterpart. Upstream removed the tracking teardown from __kho_abort() in commit 99cd2ffac697 ("kho: don't unpreserve memory during abort"), which relies on the unpreserve interfaces and the notifier removal that came with 6.19. In 6.18.y, KHO users still preserve memory from the KEXEC_KHO_FINALIZE notifier, and the teardown on abort is the only thing that drops those preservations. I kept it and changed only the free; patch 2 has the details.

Federico Parola (1):
kho: free phys_bits bitmaps using free_page() in __kho_abort()

Pratyush Yadav (1):
kho: free chunks using free_page() instead of kfree()

 kernel/kexec_handover.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.47.3