Re: [patch V2] percpu_counter: scalability works

From: Eric Dumazet
Date: Fri May 13 2011 - 12:46:41 EST


Le vendredi 13 mai 2011 Ã 18:35 +0200, Eric Dumazet a Ãcrit :

If you want to try this patch, please note I missed in
__percpu_counter_init() :

fbc->sum_cnt = 0;


> int __percpu_counter_init(struct percpu_counter *fbc, s64 amount,
> struct lock_class_key *key)
> {
> - spin_lock_init(&fbc->lock);
> - lockdep_set_class(&fbc->lock, key);
> - fbc->count = amount;
> + struct percpu_counter_rw *pcrw;
> +
> + pcrw = kzalloc(sizeof(*pcrw), GFP_KERNEL);
> + if (!pcrw)
> + return -ENOMEM;
> + atomic64_set(&pcrw->count, amount);
> +
> fbc->counters = alloc_percpu(s32);
> - if (!fbc->counters)
> + if (!fbc->counters) {
> + kfree(pcrw);
> return -ENOMEM;
> + }
> + fbc->pcrw = pcrw;

fbc->sum_cnt = 0;

>
> debug_percpu_counter_activate(fbc);
>




--
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/