On Wed, 2010-06-16 at 11:48 +0300, Avi Kivity wrote:
We do have the stuff in:+static inline void kvm_mod_used_mmu_pages(struct kvm *kvm, int nr)Needs an atomic operation, since there's no global lock here. To avoid
+{
+ kvm->arch.n_used_mmu_pages += nr;
+ kvm_total_used_mmu_pages += nr;
bouncing this cacheline around, make the variable percpu and make
readers take a sum across all cpus. Side benefit is that you no longer
need an atomic but a local_t, which is considerably cheaper.
include/linux/percpu_counter.h
the downside being that they're not precise and they're *HUGE* according
to the comment. :)
It's actually fairly difficult to do a counter which is precise,
scalable, and works well for small CPU counts when NR_CPUS is large. Do
you mind if we just stick with a plain atomic_t for now?