Re: [PATCH v2 10/12] KVM: MMU: unify the code of walking pte list

From: Xiao Guangrong
Date: Mon Jan 28 2013 - 22:01:55 EST


On 01/27/2013 09:28 PM, Gleb Natapov wrote:

>>
>> @@ -1256,19 +1243,18 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
>>
>> if (pte_write(*ptep)) {
>> drop_spte(kvm, sptep);
>> - sptep = rmap_get_first(*rmapp, &iter);
>> - } else {
>> - new_spte = *sptep & ~PT64_BASE_ADDR_MASK;
>> - new_spte |= (u64)new_pfn << PAGE_SHIFT;
>> + goto restart;
> I do not like this "goto restart" pattern throughout this patch. Follow up
> patch gets rid of most of them, so they are tolerable as a temporary solution
> here, but this one stays. What about moving pte_write(*ptep) outside
> for_each_spte_in_rmap() loop like that:
>
> if (pte_write(*ptep))
> need_flush = kvm_unmap_rmapp();
> else
> for_each_spte_in_rmap() {
> }

Nice. Will do.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/