diff mbox series

[RFC,01/15] memory: Drop mapping check from memory_region_get_ram_discard_manager()

Message ID 20211013103330.26869-2-david@redhat.com (mailing list archive)
State New, archived
Headers show
Series virtio-mem: Expose device memory via separate memslots | expand

Commit Message

David Hildenbrand Oct. 13, 2021, 10:33 a.m. UTC
It's sufficient to check whether a memory region is RAM, the region
doesn't necessarily have to be mapped into another memory region.
For example, RAM memory regions mapped via an alias will never make
"memory_region_is_mapped()" succeed.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 softmmu/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/softmmu/memory.c b/softmmu/memory.c
index 3bcfc3899b..8669f78395 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -2038,7 +2038,7 @@  int memory_region_iommu_num_indexes(IOMMUMemoryRegion *iommu_mr)
 
 RamDiscardManager *memory_region_get_ram_discard_manager(MemoryRegion *mr)
 {
-    if (!memory_region_is_mapped(mr) || !memory_region_is_ram(mr)) {
+    if (!memory_region_is_ram(mr)) {
         return NULL;
     }
     return mr->rdm;