With MHP_MEMMAP_ON_MEMORY, the core excludes the memmap at the start of
each memory block from the range passed to memory notifiers. The
virtio-mem notifier does not expect that:
* In Sub Block Mode, it rejects any range that is not exactly one
aligned memory block with a WARN and NOTIFY_BAD.
* It adjusts offline_size by the notified size, while adding and
removing memory use the full size. Every onlined memory block would
leave its memmap size behind in offline_size, until the offline
threshold stops further hotplug.
Track the memmap pages per memory block in vm->memmap_pages, expect the
notified range to start after the memmap in Sub Block Mode, and include
the memmap when adjusting offline_size.
vm->memmap_pages is always 0 for now, so there is no functional change.
Assisted-by: LLM
Signed-off-by: Nikolaos Karaolidis <redacted>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261103-virtio-mem-memmap-v1-0-308ae1da6240@karaolidis.com?part=2