[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] memory: Do not increase refcount on global system_memory reg
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 1/6] memory: Do not increase refcount on global system_memory region |
Date: |
Thu, 19 Aug 2021 16:20:34 +0200 |
system_memory is statically allocated in memory_map_init()
(softmmu/physmem.c) and is never destroyed. No need to
increment its refcount.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
softmmu/memory.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/softmmu/memory.c b/softmmu/memory.c
index bfedaf9c4df..185f978c925 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -24,7 +24,7 @@
#include "qemu/qemu-print.h"
#include "qom/object.h"
#include "trace.h"
-
+#include "exec/address-spaces.h"
#include "exec/memory-internal.h"
#include "exec/ram_addr.h"
#include "sysemu/kvm.h"
@@ -2923,7 +2923,9 @@ void address_space_remove_listeners(AddressSpace *as)
void address_space_init(AddressSpace *as, MemoryRegion *root, const char *name)
{
- memory_region_ref(root);
+ if (root != get_system_memory()) {
+ memory_region_ref(root);
+ }
as->root = root;
as->current_map = NULL;
as->ioeventfd_nb = 0;
--
2.31.1