From mboxrd@z Thu Jan 1 00:00:00 1970 From: Xiao Guangrong Subject: Re: EPT questions! Date: Wed, 1 Mar 2017 11:40:31 +0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit To: "jack.chen" , KVM maillist Return-path: Received: from mga03.intel.com ([134.134.136.65]:52580 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751499AbdCADv6 (ORCPT ); Tue, 28 Feb 2017 22:51:58 -0500 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Hash list is used as a cache. KVM is always trying to reuse the existing SP if possible. On 03/01/2017 10:46 AM, jack.chen wrote: > hello,I am confused about kvm_mmu_get_page function in KVM source > code,why it look for a the hash list first rather than alloc a new > page, what is the function of the hash list.thanks! > for_each_gfn_sp(vcpu->kvm, sp, gfn) { > > if (is_obsolete_sp(vcpu->kvm, sp)) > continue; > > if (!need_sync && sp->unsync) > need_sync = true; > > if (sp->role.word != role.word) > continue; > > if (sp->unsync && kvm_sync_page_transient(vcpu, sp)) > break; > > mmu_page_add_parent_pte(vcpu, sp, parent_pte); > if (sp->unsync_children) { > kvm_make_request(KVM_REQ_MMU_SYNC, vcpu); > kvm_mmu_mark_parents_unsync(sp); > } else if (sp->unsync) > kvm_mmu_mark_parents_unsync(sp); > > __clear_sp_write_flooding_count(sp); > trace_kvm_mmu_get_page(sp, false); > return sp; > } >