Re: [PATCH 3/11] KVM: Add spte's point in the struct kvm_mmu_page

From: Paolo Bonzini
Date: Mon Jan 07 2019 - 11:36:08 EST


On 04/01/19 09:53, lantianyu1986@xxxxxxxxx wrote:
> @@ -332,6 +332,7 @@ struct kvm_mmu_page {
> int root_count; /* Currently serving as active root */
> unsigned int unsync_children;
> struct kvm_rmap_head parent_ptes; /* rmap pointers to parent sptes */
> + u64 *sptep;

Is this really needed? Can we put the "last" flag in the struct instead
as a bool? In fact, if you do

u16 unsync_children;
bool unsync;
bool last_level;

the struct does not grow at all. :)

(I'm not sure where "large" is tested using the sptep field, even though
it is in the commit message).

Paolo

> /* The page is obsolete if mmu_valid_gen != kvm->arch.mmu_valid_gen. */
> unsigned long mmu_valid_gen;