On 27/11/2015 07:27, Peter Xu wrote: > If embed the mr pointer into GuestPhyBlock, then we might need to > ref/unref one MemoryRegion for multiple times (and I am not sure how > many, maybe it could be a very big number especially the > MemoryRegionSections are scattered?). Not sure whether it is more > efficient. > > For what I see, the number of MemoryRegions should be not big (<5 in > my case). So even with O(N^2), it should merely like O(N). Not sure > about this too. > > Would like to hear more review comments from Paolo and others. >
Fam suggestion is a good one, ref'ing one MemoryRegion many times is not a problem. Also I noticed now that you do the dump_init in the main thread (using a listener), so the RCU lock/unlock is not needed. I don't know this code very well. It's worth adding a comment at the top of functions that are called from a separate thread. Thanks, Paolo