Xiao Guangrong <xiaoguangrong@xxxxxxxxxxxxxx> wrote: > > We optimize multi level guest page table walk as follows: > > > > 1. We cache the memslot which, probably, includes the next guest page > > tables to avoid searching for it many times. > > Yeah, the hit is very high, after optimizing the algorithm of memslots > (http://lwn.net/Articles/429308/), maybe the advantage is not so significant, > could you apply this patchset and test again please? Any sorting, including tree based, strategies have tradoffs. Compared to that, what I wanted to do here was to improve the table walk locally without sacrificing other things. Of course, my strategy depends on the assumption that the page tables will be in the same slot in very high probability. So if certain algorithm seems to be addapted, yes, I will test based on that. IIRC, any practically good algorithm has not been found yet, right? > > > 2. We use get_user() instead of copy_from_user(). > > > > Note that this is kind of a restricted way of Xiao's more generic > > work: "KVM: optimize memslots searching and cache GPN to GFN." > > > > With this patch applied, paging64_walk_addr_generic() has improved > > as the following tracing results show. > > > > + > > + if (!(*slot_hint) || !gfn_in_memslot(*slot_hint, real_gfn)) > > + *slot_hint = gfn_to_memslot(vcpu->kvm, real_gfn); > > + > > You forgot to check the result. (if *slot_hint == NULL)? ... ;-) Thank you! I will check later. Takuya -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html