From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [patch 1/3] KVM: MMU: collapse remote TLB flushes on root sync Date: Fri, 31 Oct 2008 17:30:37 -0200 Message-ID: <20081031193037.GA21772@dmt.cnet> References: <20081025223111.498934405@localhost.localdomain> <20081025223243.782692567@localhost.localdomain> <490451BA.8040800@redhat.com> <20081029232658.GA27937@dmt.cnet> <490986B1.2050509@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Chris Wright To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:60354 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751797AbYJaTcA (ORCPT ); Fri, 31 Oct 2008 15:32:00 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id m9VJW012024691 for ; Fri, 31 Oct 2008 15:32:00 -0400 Content-Disposition: inline In-Reply-To: <490986B1.2050509@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Oct 30, 2008 at 12:04:33PM +0200, Avi Kivity wrote: > Marcelo Tosatti wrote: >> There is significant overhead now in comparison to the early indexing >> scheme with a list per root. It must be optimized. >> > > What's the typical number of (1) unsynced pages and (2) unsynced pages > belonging to next cr3 when switching cr3? > > I'm guessing (1) and (2) are almost equal, and both fairly large? About 1% of memory unsynced (including pages that are not pagetables anymore, so the value is not exact). Not equal, (2) a hundred or so. > Perhaps it can simply collect the pages, then do a write-protect pass, > tlb flush, and resync pass. The two passes are now over L1 cached data > so they're not too expensive. Thats what its doing. > We could: > - keep all three parents in the array > - for the bitmap, keep a count of how many bits are set > - when we clear a bit, we dec the count, and if zero, we clear the bit > in the parent's parent. Yep.