From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v3 16/19] KVM: MMU: lockless walking shadow page table Date: Thu, 7 Jul 2011 05:18:35 -0300 Message-ID: <20110707081835.GC8334@amt.cnet> References: <4E0C3178.2080603@cn.fujitsu.com> <4E0C3337.5040304@cn.fujitsu.com> <20110706180859.GB9820@amt.cnet> <4E14B6D6.4020902@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , LKML , KVM To: Xiao Guangrong Return-path: Content-Disposition: inline In-Reply-To: <4E14B6D6.4020902@cn.fujitsu.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Thu, Jul 07, 2011 at 03:26:14AM +0800, Xiao Guangrong wrote: > On 07/07/2011 02:08 AM, Marcelo Tosatti wrote: > > >> +static void free_pages_rcu(struct rcu_head *head) > >> +{ > >> + struct kvm_mmu_page *next, *sp; > >> + > >> + sp = container_of(head, struct kvm_mmu_page, rcu); > >> + while (sp) { > >> + if (!list_empty(&sp->link)) > >> + next = list_first_entry(&sp->link, > >> + struct kvm_mmu_page, link); > >> + else > >> + next = NULL; > >> + kvm_mmu_free_page(sp); > >> + sp = next; > >> + } > >> +} > > > > There is no need for this while loop. > > > > The while loop is needed, since many shadow pages can be freed together in > the rcu context, on commit_zap_page path, we only remove the list head, and > the shadow page is still listed. Right.