Skip to content

mm, kho: count KHO bootmem in CmaTotal and in zoneinfo's cma

Chris Down kexec linux-mm lkml 2 versions – Applied

Status from this message: Applied to liveupdate-7.5 branch of liveupdate/linux.git tree, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyApplied
  2. v12 patches 2 repliesSuperseded

Changes in v2 from the cover letter

- Rebase onto the liveupdate tree's next, where kexec_handover.c is now kho_core.c
- Say that kho_init() bypasses bootmem initialisation on a KHO boot (Mike)
- Add a comment on why pageblocks in CMA areas are skipped (Mike)
- Add before and after tables from a KHO kexec to both patches (Mike)

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2kho: count bootmem in zoneinfo's cma after a KHO kexeckernel/liveupdate/kho_core.c+37 -00 replies
2/2kho: count bootmem in CmaTotalkernel/liveupdate/kho_core.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] mm, kho: count KHO bootmem in CmaTotal and in zoneinfo's cma

KHO bootmem is handed to the buddy allocator in MIGRATE_CMA pageblocks, so its free pages show up in CmaFree, but two of the CMA counters leave it out. CmaTotal in /proc/meminfo never includes it, and the cma line in /proc/zoneinfo includes it after a cold boot but goes to 0 after a KHO kexec.

Patch 1 counts bootmem in zone->cma_pages after a KHO kexec, as kho_init() already does on a cold boot. Patch 2 then adds bootmem to totalcma_pages after both kinds of boot.

After a KHO kexec, part of bootmem is still held by early boot, like the kernel image and initrd that kexec loaded there and some of the memmap. Those pages are counted too, because they're still in MIGRATE_CMA pageblocks and some of them come back as free CMA pages later on, such as the init sections and memmap pages freed by hugetlb vmemmap optimisation. Leaving them out would let CmaFree overtake CmaTotal again.

The bootmem added to both counters comes from kho_init(), which runs long after mem_init_print_info(), so the "Memory:" boot line doesn't change.

This came up in the thread about making bootmem visible to monitoring [0].

v2:

- Rebase onto the liveupdate tree's next, where kexec_handover.c is now kho_core.c
- Say that kho_init() bypasses bootmem initialisation on a KHO boot (Mike)
- Add a comment on why pageblocks in CMA areas are skipped (Mike)
- Add before and after tables from a KHO kexec to both patches (Mike)

v1: https://lore.kernel.org/r/[email protected]

[0]: https://lore.kernel.org/r/[email protected]

Chris Down (2):
kho: count bootmem in zoneinfo's cma after a KHO kexec
kho: count bootmem in CmaTotal

 kernel/liveupdate/kho_core.c | 39 ++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

base-commit: 0f80f5e2823eed06bd38315ca5077701e739017a

Signature · 1 line
2.56.1