[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH resend v2 5/5] softmmu/memory_mapping: optimize for RamDiscar
Re: [PATCH resend v2 5/5] softmmu/memory_mapping: optimize for RamDiscardManager sections
Mon, 26 Jul 2021 11:24:15 -0400
On Tue, Jul 20, 2021 at 03:03:04PM +0200, David Hildenbrand wrote:
> virtio-mem logically plugs/unplugs memory within a sparse memory region
> and notifies via the RamDiscardManager interface when parts become
> plugged (populated) or unplugged (discarded).
> Currently, we end up (via the two users)
> 1) zeroing all logically unplugged/discarded memory during TPM resets.
> 2) reading all logically unplugged/discarded memory when dumping, to
> figure out the content is zero.
> 1) is always bad, because we assume unplugged memory stays discarded
> (and is already implicitly zero).
> 2) isn't that bad with anonymous memory, we end up reading the zero
> page (slow and unnecessary, though). However, once we use some
> file-backed memory (future use case), even reading will populate memory.
> Let's cut out all parts marked as not-populated (discarded) via the
> RamDiscardManager. As virtio-mem is the single user, this now means that
> logically unplugged memory ranges will no longer be included in the
> dump, which results in smaller dump files and faster dumping.
> virtio-mem has a minimum granularity of 1 MiB (and the default is usually
> 2 MiB). Theoretically, we can see quite some fragmentation, in practice
> we won't have it completely fragmented in 1 MiB pieces. Still, we might
> end up with many physical ranges.
> Both, the ELF format and kdump seem to be ready to support many
> individual ranges (e.g., for ELF it seems to be UINT32_MAX, kdump has a
> linear bitmap).
> Cc: Marc-André Lureau <firstname.lastname@example.org>
> Cc: Paolo Bonzini <email@example.com>
> Cc: "Michael S. Tsirkin" <firstname.lastname@example.org>
> Cc: Eduardo Habkost <email@example.com>
> Cc: Alex Williamson <firstname.lastname@example.org>
> Cc: Dr. David Alan Gilbert <email@example.com>
> Cc: Igor Mammedov <firstname.lastname@example.org>
> Cc: Claudio Fontana <email@example.com>
> Cc: Thomas Huth <firstname.lastname@example.org>
> Cc: "Alex Bennée" <email@example.com>
> Cc: Peter Xu <firstname.lastname@example.org>
> Cc: Laurent Vivier <email@example.com>
> Cc: Stefan Berger <firstname.lastname@example.org>
> Signed-off-by: David Hildenbrand <email@example.com>
Reviewed-by: Peter Xu <firstname.lastname@example.org>
- Re: [PATCH resend v2 3/5] softmmu/memory_mapping: never merge ranges accross memory regions, (continued)
- Re: [PATCH resend v2 5/5] softmmu/memory_mapping: optimize for RamDiscardManager sections,
Peter Xu <=