Re: [patch V3] percpu_counter: scalability works
From: Eric Dumazet
Date: Mon May 16 2011 - 05:35:14 EST
Le lundi 16 mai 2011 Ã 16:34 +0800, Shaohua Li a Ãcrit :
> let's not argue the batch size anymore. If we can make percpu_counter
> faster, why we don't (even your patch mentioned this).
>
I actually changed my mind, after trying to solve the problem and spend
a few hours on it. This is not worth it and counterproductive.
Whole point of percpu_counter is being able to avoid the false sharing
in _most_ cases. I would even make the false sharing case even more
expensive just to pinpoint a bad user, thanks to profiling.
Trying to make it fast in pathological case is throwing a brown paper
bag.
An interesting move would be to make percpu_counter hierarchical,
because we might need it for 4096 cpus machines.
Given that vm_committed has one percent resolution need
(sysctl_overcommit_ratio is expressed with percent resolution), it
should be used with an appropriate batch value, something like :
vm_committed_as_batch = max(percpu_counter_batch,
total_ram_pages/(num_possible_cpus()*100));
Instead of the default percpu_counter_batch, more aimed for
_add(1)/_add(-1) uses.
Note : This wont solve your mmap(128M)/munmap() problem, unless your
machine has a _lot_ of memory. Still, this will be a win on many real
workloads.
--
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/