From: "Jan Beulich" Subject: Re: [PATCH v2 3/3] xen: use idle vcpus to scrub pages Date: Wed, 23 Jul 2014 08:28:32 +0100 Message-ID: <53CF80400200007800024F2B@mail.emea.novell.com> References: <1404135584-29206-1-git-send-email-bob.liu@oracle.com> <1404135584-29206-3-git-send-email-bob.liu@oracle.com> <53B2979C020000780001EE97@mail.emea.novell.com> <53B2A8C7.9040601@oracle.com> <53B2CCD1020000780001F027@mail.emea.novell.com> <53C4F171.8060807@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X9qya-00045G-7E for xen-devel@lists.xenproject.org; Wed, 23 Jul 2014 07:28:36 +0000 In-Reply-To: <53C4F171.8060807@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Bob Liu Cc: Bob Liu , keir@xen.org, ian.campbell@citrix.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 15.07.14 at 11:16, wrote: > After so many days I haven't make a workable solution if don't remove > pages temporarily. The hardest part is iterating the heap free list > without holding heap_lock because if holding the lock it might be heavy > lock contention. > So do you think it's acceptable if fixed all other concerns about this > patch? No, I don't think so. Instead I'm of the opinion that you may have worked in the wrong direction: Rather than not taking the heap lock at all, it may also be sufficient to shrink the lock holding time (i.e. avoid long loops with the lock held). > And there is another idea based on the assumption that only guest > allocation need all pages to be scrubbed(It's safe for xen hypervisor to > use an un-scrubbed page): > 1. set the need_scrub flag in free_heap_pages(). > 2. alloc pages from heap free list, don't scrub and neither clear the > need_scrub flag. > 3. When the guest accessing the real memory(machine pages) the first > time, page fault should happen. We track this event and before build the > right PFN to MFN page table mappings(correct me if it doesn't work as > this), at this place scrub the page if the need_scrub flag was set. > > By this way only guest real used pages are needed scrubbing and the time > is scattered. > How do you think of this solution? If you can get this to work cleanly for all guest types, that would certainly be an option. Jan