Skip to content

mm/kdump: allow to exclude pages that are logically offline

David Hildenbrand kexec linux-doc linux-fsdevel linux-mm linux-pm lkml xen-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 46 repliesIn review

Changes in v1 from the cover letter

- Add "PM / Hibernate: use pfn_to_online_page()"
- Add "vmw_balloon: mark inflated pages PG_offline"
- "mm: convert PG_balloon to PG_offline"
-- After discussions, also rename the UAPI bit name (KPF_BALLOON -> KPF_OFFLINE)

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8mm: balloon: update comment about isolation/migration/compactioninclude/linux/balloon_compaction.h+9 -172 replies
1/8mm: balloon: update comment about isolation/migration/compactioninclude/linux/balloon_compaction.h+9 -170 replies
2/8mm: convert PG_balloon to PG_offlineDocumentation/admin-guide/mm/pagemap.rst fs/proc/page.c include/linux/balloon_compaction.h +3 more+21 -158 replies
2/8mm: convert PG_balloon to PG_offlineDocumentation/admin-guide/mm/pagemap.rst fs/proc/page.c include/linux/balloon_compaction.h +3 more+21 -150 replies
3/8kexec: export PG_offline to VMCOREINFOkernel/crash_core.c+2 -08 replies
3/8kexec: export PG_offline to VMCOREINFOkernel/crash_core.c+2 -00 replies
4/8xen/balloon: mark inflated pages PG_offlinedrivers/xen/balloon.c+3 -04 replies
4/8xen/balloon: mark inflated pages PG_offlinedrivers/xen/balloon.c+3 -00 replies
5/8hv_balloon: mark inflated pages PG_offlinedrivers/hv/hv_balloon.c+12 -28 replies
5/8hv_balloon: mark inflated pages PG_offlinedrivers/hv/hv_balloon.c+12 -20 replies
6/8vmw_balloon: mark inflated pages PG_offlinedrivers/misc/vmw_balloon.c+32 -04 replies
6/8vmw_balloon: mark inflated pages PG_offlinedrivers/misc/vmw_balloon.c+32 -00 replies
7/8PM / Hibernate: use pfn_to_online_page()kernel/power/snapshot.c+4 -46 replies
7/8PM / Hibernate: use pfn_to_online_page()kernel/power/snapshot.c+4 -40 replies
8/8PM / Hibernate: exclude all PageOffline() pageskernel/power/snapshot.c+4 -16 replies
8/8PM / Hibernate: exclude all PageOffline() pageskernel/power/snapshot.c+4 -10 replies

Reviews trailers per patch

14 of 16 patches have a Reviewed-by or Acked-by.

PatchPavel MachekKonstantin KhlebnikovMichal HockoRafael J. WysockiPankaj guptaMichael S. TsirkinDave YoungNadav Amit
1/8A-b A-b
1/8A-b A-b
2/8A-b A-b A-b A-b A-b A-b
2/8A-b A-b A-b A-b A-b A-b
3/8A-b A-b A-b A-b
3/8A-b A-b A-b A-b
4/8
4/8
5/8A-b A-b
5/8A-b A-b
6/8A-b A-b
6/8A-b A-b
7/8A-b A-b A-b A-b A-b A-b
7/8A-b A-b A-b A-b A-b A-b
8/8A-b A-b A-b A-b
8/8A-b A-b A-b A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 8 reviewers.

Read the v1 thread

Cover letter [PATCH v1 0/8] mm/kdump: allow to exclude pages that are logically offline

Right now, pages inflated as part of a balloon driver will be dumped by dump tools like makedumpfile. While XEN is able to check in the crash kernel whether a certain pfn is actuall backed by memory in the hypervisor (see xen_oldmem_pfn_is_ram) and optimize this case, dumps of virtio-balloon, hv-balloon and VMWare balloon inflated memory will essentially result in zero pages getting allocated by the hypervisor and the dump getting filled with this data.

The allocation and reading of zero pages can directly be avoided if a dumping tool could know which pages only contain stale information not to be dumped.

Also for XEN, calling into the kernel and asking the hypervisor if a pfn is backed can be avoided if the duming tool would skip such pages right from the beginning.

Dumping tools have no idea whether a given page is part of a balloon driver and shall not be dumped. Esp. PG_reserved cannot be used for that purpose as all memory allocated during early boot is also PG_reserved, see discussion at [1]. So some other way of indication is required and a new page flag is frowned upon.

We have PG_balloon (MAPCOUNT value), which is essentially unused now. I suggest renaming it to something more generic (PG_offline) to mark pages as logically offline. This flag can than e.g. also be used by virtio-mem in the future to mark subsections as offline. Or by other code that wants to put pages logically offline (e.g. later maybe poisoned pages that shall no longer be used).

This series converts PG_balloon to PG_offline, allows dumping tools to query the value to detect such pages and marks pages in the hv-balloon and XEN balloon properly as PG_offline. Note that virtio-balloon already set pages to PG_balloon (and now PG_offline).

Please note that this is also helpful for a problem we were seeing under
Hyper-V: Dumping logically offline memory (pages kept fake offline while onlining a section via online_page_callback) would under some condicions result in a kernel panic when dumping them.

As I don't have access to neither XEN nor Hyper-V nor VMWare installations, this was only tested with the virtio-balloon and pages were properly skipped when dumping. I'll also attach the makedumpfile patch to this series.

[1] https://lkml.org/lkml/2018/7/20/566

RFC -> v1:
- Add "PM / Hibernate: use pfn_to_online_page()"
- Add "vmw_balloon: mark inflated pages PG_offline"
- "mm: convert PG_balloon to PG_offline"
-- After discussions, also rename the UAPI bit name (KPF_BALLOON -> KPF_OFFLINE)

David Hildenbrand (8):
mm: balloon: update comment about isolation/migration/compaction
mm: convert PG_balloon to PG_offline
kexec: export PG_offline to VMCOREINFO
xen/balloon: mark inflated pages PG_offline
hv_balloon: mark inflated pages PG_offline
vmw_balloon: mark inflated pages PG_offline
PM / Hibernate: use pfn_to_online_page()
PM / Hibernate: exclude all PageOffline() pages

 Documentation/admin-guide/mm/pagemap.rst |  9 ++++---
 drivers/hv/hv_balloon.c                  | 14 ++++++++--
 drivers/misc/vmw_balloon.c               | 32 ++++++++++++++++++++++
 drivers/xen/balloon.c                    |  3 +++
 fs/proc/page.c                           |  4 +--
 include/linux/balloon_compaction.h       | 34 +++++++++---------------
 include/linux/page-flags.h               | 11 +++++---
 include/uapi/linux/kernel-page-flags.h   |  2 +-
 kernel/crash_core.c                      |  2 ++
 kernel/power/snapshot.c                  | 13 +++++----
 tools/vm/page-types.c                    |  2 +-
 11 files changed, 87 insertions(+), 39 deletions(-)
Signature · 1 line
2.17.2