[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH qemu v4 15/18] memory: Share special empty FlatView
From: |
Alexey Kardashevskiy |
Subject: |
[Qemu-devel] [PATCH qemu v4 15/18] memory: Share special empty FlatView |
Date: |
Wed, 20 Sep 2017 21:46:34 +1000 |
This shares an cached empty FlatView among address spaces. The empty
FV is used every time when a root MR renders into a FV without memory
sections which happens when MR or its children are not enabled or
zero-sized. The empty_view is not NULL to keep the rest of memory
API intact; it also has a dispatch tree for the same reason.
On POWER8 with 255 CPUs, 255 virtio-net, 40 PCI bridges guest this halves
the amount of FlatView's in use (557 -> 260) and dispatch tables
(~800000 -> ~370000), however the total memory footprint is pretty much
the same as RCU is holding all these temporary FVs which are created
(and then released) to make sure that they are empty and can be replaced
with @empty_view.
Signed-off-by: Alexey Kardashevskiy <address@hidden>
---
memory.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/memory.c b/memory.c
index 4add0fd030..92b1304a20 100644
--- a/memory.c
+++ b/memory.c
@@ -48,6 +48,7 @@ static QTAILQ_HEAD(, AddressSpace) address_spaces
= QTAILQ_HEAD_INITIALIZER(address_spaces);
static GHashTable *flat_views;
+static FlatView *empty_view;
typedef struct AddrRange AddrRange;
@@ -755,6 +756,19 @@ static FlatView *generate_memory_topology(MemoryRegion *mr)
}
flatview_simplify(view);
+ if (!view->nr) {
+ flatview_unref(view);
+ if (!empty_view) {
+ empty_view = flatview_new(NULL);
+ }
+ view = empty_view;
+ flatview_ref(view);
+ }
+
+ if (view->dispatch) {
+ return view;
+ }
+
view->dispatch = address_space_dispatch_new(view);
for (i = 0; i < view->nr; i++) {
MemoryRegionSection mrs =
--
2.11.0
- [Qemu-devel] [PATCH qemu v4 00/18] memory: Reduce memory use, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 01/18] exec: Explicitly export target AS from address_space_translate_internal, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 17/18] memory: Create FlatView directly, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 12/18] memory: Share FlatView's and dispatch trees between address spaces, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 13/18] memory: Do not allocate FlatView in address_space_init, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 06/18] memory: Switch memory from using AddressSpace to FlatView, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 15/18] memory: Share special empty FlatView,
Alexey Kardashevskiy <=
- [Qemu-devel] [PATCH qemu v4 02/18] memory: Open code FlatView rendering, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 10/18] memory: Alloc dispatch tree where topology is generared, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 08/18] memory: Rename mem_begin/mem_commit/mem_add helpers, Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 09/18] memory: Store physical root MR in FlatView, Alexey Kardashevskiy, 2017/09/20