Re: [PATCH v2 3/9] KVM: MMU: introduce for_each_slot_rmap_range

From: Paolo Bonzini
Date: Tue May 12 2015 - 05:29:45 EST




On 12/05/2015 04:32, Xiao Guangrong wrote:
> +#define for_each_slot_rmap_range(_slot_, _start_level_, _end_level_, \
> + _start_gfn, _end_gfn, _iter_) \
> + for (slot_rmap_walk_init(_iter_, _slot_, _start_level_, \
> + _end_level_, _start_gfn, _end_gfn); \
> + slot_rmap_walk_okay(_iter_); \
> + slot_rmap_walk_next(_iter_))
> +


> + for_each_slot_rmap_range(memslot, PT_PAGE_TABLE_LEVEL,
> + PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES - 1,


What about adding a

#define for PT_MAX_HUGEPAGE_LEVEL (PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES - 1)

?

> + gfn_start, gfn_end - 1, &iterator)
> + ret |= handler(kvm, iterator.rmap, memslot,
> + iterator.gfn, iterator.level, data);

I prefer to indent by two tabs:

for_each_slot_rmap_range(memslot,
PT_PAGE_TABLE_LEVEL, PT_MAX_HUGEPAGE_LEVEL,
gfn_start, gfn_end - 1, &iterator)
ret |= handler(kvm, iterator.rmap, memslot,
iterator.gfn, iterator.level, data);


Same in the next patch:

for_each_slot_rmap_range(memslot,
start_level, end_level,
start_gfn, end_gfn, &iterator) {
if (iterator.rmap)
flush |= fn(kvm, iterator.rmap);
...
}
Thanks,

Paolo
--
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/