lkml.org 
[lkml]   [2010]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] percpu_counter : add percpu_counter_add_fast()
On Sat, 16 Oct 2010, Eric Dumazet wrote:

> I based following patch against linux-2.6, I dont know if previous
> Christoph patch is in a git tree. I'll respin it eventually.

The prior patch was accepted by Andrew.

> + * - It is preempt safe, but not IRQ safe (on UP)

The IRQ safeness depends on the arch. this_cpu_add() in general only
guarantees safety against preemption. It so happens that the x86
implementation is irq safe as well.

The IRQ safety for UP is therefore not an issue if you use this_cpu_add().

If you want to guarantee irqsafeness then use irqsafe_cpu_add() instead.
It generates the same code on x86 for SMP but takes care of the UP issues.

> +static inline void percpu_counter_add_fast(struct percpu_counter *fbc, long amount)
> +{
> + this_cpu_add(*fbc->counters, amount);
> +}

What happens in case of counter overflow?



\
 
 \ /
  Last update: 2010-10-18 17:27    [W:0.137 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site