From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: RFC: shadow page table reclaim Date: Wed, 02 Sep 2009 14:31:20 +0300 Message-ID: <4A9E5788.2000306@redhat.com> References: <200908280431.04960.max@laiers.net> <200908311409.09346.max@laiers.net> <4A9BC4BD.2010308@redhat.com> <200909020424.03358.max@laiers.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Max Laier Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41929 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751689AbZIBLbX (ORCPT ); Wed, 2 Sep 2009 07:31:23 -0400 In-Reply-To: <200909020424.03358.max@laiers.net> Sender: kvm-owner@vger.kernel.org List-ID: On 09/02/2009 05:24 AM, Max Laier wrote: > Okay ... I have/something/, but I'm certainly not there yet as I have to > admit that I don't understand your idea completely. In addition it seems that > EPT doesn't have an accessed bit :-\ Any idea for this? > Use the rwx bits as an approximation. If the pages are needed they'll be faulted back in, which is a lot cheaper than reconstructing them. But why do you see reclaim with ept? The pages ought to be constructed once and then left alone, unless there is severe memory pressure. > Regardless, testing the attached with EPT, it turns out that not zapping > shadow pages with root_count != 0 already makes much difference. After all we > don't really zap these pages anyways, but just mark them invalid after zapping > the children. So this could be a first improvement. > > In any case, I clearly don't have the right idea here, yet. Plus I don't > really have time to look into this further right now. And my hack is "good > enough"[tm] for my testing ... so if anyone more knowledgeable would like to > continue - much appreciated. Maybe some of this can at least serve as food > for thoughts. Sorry. > Sure. > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index a3f637f..089ad0e 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -394,6 +394,7 @@ struct kvm_arch{ > * Hash table of struct kvm_mmu_page. > */ > struct list_head active_mmu_pages; > + struct kvm_mmu_page *scan_hand; > struct list_head assigned_dev_head; > struct iommu_domain *iommu_domain; > int iommu_flags; > Why is a scan hand needed? I though you could just clear the accessed bits and requeue the page. If you drop a page, all the accessed bits in the ptes are lost with it, so you need to transfer them to the pointed-to pages before you dropped it. Other than that, this seems pretty complete. -- error compiling committee.c: too many arguments to function