On 19/09/17 17:42, Paolo Bonzini wrote: > On 19/09/2017 08:57, Alexey Kardashevskiy wrote: >>>> 2) also, after patch 2 you know that the address space has no listeners >>>> here, so the begin/commit isn't really needed. Instead you can use the >>>> open-coded loop to directly generate the FlatView. This avoids touching >>>> _all_ address spaces, which is already an improvement from O(n^2) to >>>> O(n) rebuilds on device startup. >> 03/13 does this already, no? >> > > No, there's still > > as->dispatch = NULL; > memory_region_update_pending |= root->enabled; > memory_region_transaction_commit(); > > when creating the address space, which touches all address spaces.
This does not seem helping a lot - my test without such an optimization allocates 2966044 FVs and 2388768 with it, which is just 25%, i.e. worth making a patch but yet getting rid of those nasty virtio-modern address spaces will do a lot better job. What is the exact concern about the "[PATCH qemu v3 01/13] memory: Postpone flatview and dispatch tree building till all devices are added"? Is it that you missed that modern AS thing in virtio and thought we can do well even without it? Or there is something wrong with the approach? -- Alexey