[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH qemu v4 15/18] memory: Share special empty FlatV
From: |
Alexey Kardashevskiy |
Subject: |
Re: [Qemu-devel] [PATCH qemu v4 15/18] memory: Share special empty FlatView |
Date: |
Thu, 21 Sep 2017 09:48:10 +1000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 21/09/17 03:13, Paolo Bonzini wrote:
> On 20/09/2017 13:46, Alexey Kardashevskiy wrote:
>> 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);
>
> This can be changed to flatview_destroy directly to avoid overloading
> RCU with all these temporary FlatViews.
Yeah, this or just allocate every new FlatView on the stack first, I
thought about this a second after I posted this.
>
> Paolo
>
>> + 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 =
>>
>
--
Alexey
- [Qemu-devel] [PATCH qemu v4 01/18] exec: Explicitly export target AS from address_space_translate_internal, (continued)
- [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, 2017/09/20
- [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
- [Qemu-devel] [PATCH qemu v4 14/18] memory: Add flat views to HMP "info mtree", Alexey Kardashevskiy, 2017/09/20
- [Qemu-devel] [PATCH qemu v4 07/18] memory: Cleanup after switching to FlatView, Alexey Kardashevskiy, 2017/09/20