]> git.proxmox.com Git - mirror_qemu.git/commit
memory: Clarify mapping requirements for RamDiscardManager
authorDavid Hildenbrand <david@redhat.com>
Tue, 26 Sep 2023 18:57:33 +0000 (20:57 +0200)
committerDavid Hildenbrand <david@redhat.com>
Thu, 12 Oct 2023 12:15:22 +0000 (14:15 +0200)
commitaa5317ef7cbf3a322b423a7b63625959b82b1a62
tree2f68110203967209804819704939557c847b5a24
parenta2335113aeda1cddad3dc4a76f2ace47a00d7ac9
memory: Clarify mapping requirements for RamDiscardManager

We really only care about the RAM memory region not being mapped into
an address space yet as long as we're still setting up the
RamDiscardManager. Once mapped into an address space, memory notifiers
would get notified about such a region and any attempts to modify the
RamDiscardManager would be wrong.

While "mapped into an address space" is easy to check for RAM regions that
are mapped directly (following the ->container links), it's harder to
check when such regions are mapped indirectly via aliases. For now, we can
only detect that a region is mapped through an alias (->mapped_via_alias),
but we don't have a handle on these aliases to follow all their ->container
links to test if they are eventually mapped into an address space.

So relax the assertion in memory_region_set_ram_discard_manager(),
remove the check in memory_region_get_ram_discard_manager() and clarify
the doc.

Message-ID: <20230926185738.277351-14-david@redhat.com>
Reviewed-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
include/exec/memory.h
system/memory.c