Re: [PATCH] percpu_counter : add percpu_counter_add_fast()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le lundi 18 octobre 2010 Ã 10:24 -0500, Christoph Lameter a Ãcrit :
> 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().
> 

Nope, on UP, we dont use a per_cpu field, just a "s64 count".

struct percpu_counter {
        s64 count;
};



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

Nothing special, as I stated the usuable width of such counters would be
restricted to a long, not an s64.

It should be enough to count "number of inodes, of sockets, ..."



--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux