lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 18 Oct 2010 17:39:40 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Christoph Lameter <cl@...ux.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Nick Piggin <npiggin@...nel.dk>,
	Dave Chinner <david@...morbit.com>,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] percpu_counter : add percpu_counter_add_fast()

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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ