Suggested fixup. Return from slowpath and update percpu variable under spinlock. Signed-off-by: Christoph Lameter <cl@xxxxxxxxx> --- lib/percpu_counter.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Index: linux-2.6/lib/percpu_counter.c =================================================================== --- linux-2.6.orig/lib/percpu_counter.c 2011-04-13 17:20:41.000000000 -0500 +++ linux-2.6/lib/percpu_counter.c 2011-04-13 17:21:33.000000000 -0500 @@ -82,13 +82,9 @@ void __percpu_counter_add(struct percpu_ spin_lock(&fbc->lock); count = __this_cpu_read(*fbc->counters); fbc->count += count + amount; + __this_cpu_write(*fbc->counters, 0); spin_unlock(&fbc->lock); - /* - * If cmpxchg fails then we need to subtract the amount that - * we found in the percpu value. - */ - amount = -count; - new = 0; + return; } } while (this_cpu_cmpxchg(*fbc->counters, count, new) != count); -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxxx For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>