On Mon, 2007-10-01 at 10:03 -0700, Dave Hansen wrote:
No, it handles hotplug because it does every possible CPU, not every
online CPU. percpu_counters empties cpu's counter presumably to avoid
systematic error.
Renaming percpu_counters to approximate_counters here would be nice.
You missed removing struct module_ref, too. That's a little more code.
Well, there is already a branch in the fast path. BTW, comparing before
and after applying your patch for a try_module_get/module_put pair, I
get 5.9 ns vs 20.6 ns. We perhaps win something back on NUMA-like
machines, but it's not clear.
My initial implementation of such a counter used atomic ops via a
pointer. The pointer was aimed at a shared counter for slow-mode. The
problem is that you need to disable preemption around the counter update
(so you can use rcu to ensure everyone has seen the changeover).
Indeed, that's why I called it "stop_machine". The real-time coders
hate it too.
Cheers,
Rusty.
-