On 21/09/17 15:22, Alexey Kardashevskiy wrote: > On 21/09/17 10:02, Alexey Kardashevskiy wrote: >> On 21/09/17 03:15, Paolo Bonzini wrote: >>> On 20/09/2017 13:46, Alexey Kardashevskiy wrote: >>>> Address spaces get to keep a root MR (alias or not) but FlatView stores >>>> the actual MR as this is going to be used later on to decide whether to >>>> share a particular FlatView or not. >>>> >>>> Signed-off-by: Alexey Kardashevskiy <a...@ozlabs.ru> >>>> --- >>>> Changes: >>>> v4: >>>> * s/memory_region_unalias_entire/memory_region_get_flatview_root/ >>> >>> Did you try the idea of checking for single-child regions too? >> >> No, I did not, I do not see how I can actually measure the difference - the >> PCI and virtio root MRs or single child MRs are unique anyway, I can save >> some time by just checking for 2 @enabled flags instead of rendering a >> FlatView but rendering such cases itself is fast as well. I'll give a try >> though. > > I tried. memory_region_get_flatview_root() returns a last child which still > covers the same space as the root; generate_memory_topology() checks for > @enabled first and only if it is enabled - renders a new FV (this solves > PCI busmater). > > With 256 CPUs and 256 virtio devices this saves 0.1s (20.4s -> 20.3s) and > 100MB of RAM (14.38G -> 14.28G) :) I'll push it out anyway.
Hm. Actually using that child as a root for FV in 09/18 increases memory use from 18G to 20G. If I just check the nested MR if it is not enabled, this does not change a thing - time and memory use is the same. Well, it is beyond accuracy of my measurements :) -- Alexey