From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2G2q-0007Tr-OI for qemu-devel@nongnu.org; Fri, 27 Nov 2015 05:14:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a2G2m-0008KF-On for qemu-devel@nongnu.org; Fri, 27 Nov 2015 05:14:24 -0500 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]:33685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a2G2m-0008Jv-GJ for qemu-devel@nongnu.org; Fri, 27 Nov 2015 05:14:20 -0500 Received: by wmec201 with SMTP id c201so63524860wme.0 for ; Fri, 27 Nov 2015 02:14:19 -0800 (PST) Sender: Paolo Bonzini References: <1448592497-2462-1-git-send-email-peterx@redhat.com> <1448592497-2462-4-git-send-email-peterx@redhat.com> <20151127051425.GC14568@ad.usersys.redhat.com> <5657F7C7.1010909@redhat.com> From: Paolo Bonzini Message-ID: <56582CF9.9070602@redhat.com> Date: Fri, 27 Nov 2015 11:14:17 +0100 MIME-Version: 1.0 In-Reply-To: <5657F7C7.1010909@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 3/8] dump-guest-memory: add basic "detach" support. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Xu , Fam Zheng Cc: qemu-devel@nongnu.org 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