Thanks,I found everytime KVM creates a new kvm_mmu_page,it instert it to hash list,but why the list have alweady existed SP corresponding to specific gfn?? how KVM maintain the hash list?? thanks 2017-03-01 11:40 GMT+08:00 Xiao Guangrong <guangrong.xiao@xxxxxxxxxxxxxxx>: > > 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; >> } >> >