• Andrew Morton's avatar
    percpu_counters(): use cpu notifiers · c67ad917
    Andrew Morton authored
    per-cpu counters presently must iterate over all possible CPUs in the
    exhaustive percpu_counter_sum().
    
    But it can be much better to only iterate over the presently-online CPUs.  To
    do this, we must arrange for an offlined CPU's count to be spilled into the
    counter's central count.
    
    We can do this for all percpu_counters in the machine by linking them into a
    single global list and walking that list at CPU_DEAD time.
    
    (I hope.  Might have race windows in which the percpu_counter_sum() count is
    inaccurate?)
    
    Cc: Gautham R Shenoy <ego@in.ibm.com>
    Cc: Oleg Nesterov <oleg@tv-sign.ru>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    c67ad917
percpu_counter.c 2.45 KB