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] [day] [month] [year] [list]
Date:	Thu, 17 Apr 2014 11:21:06 -0700
From:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To:	Christoph Lameter <cl@...ux.com>
Cc:	linux-kernel@...r.kernel.org, mingo@...nel.org, tj@...nel.org,
	grygorii.strashko@...com, peterz@...radead.org
Subject: Re: How do I increment a per-CPU variable without warning?

On Thu, Apr 17, 2014 at 12:53:28PM -0500, Christoph Lameter wrote:
> On Thu, 17 Apr 2014, Paul E. McKenney wrote:
> 
> > Fair enough!  I resent the patch with your Ack to Tejun.
> 
> Also note that you may want to use
> 
> 	this_cpu_inc
> 
> instead of raw_cpu_inc.
> 
> this_cpu_inc will not disable preemption or anything on x86 but just
> create a single instruction using instruction atomicity to avoid the
> preempt on/off sequence.
> 
> 
> On platforms that cannot emit such an instruction it will fallback to
> disable interrupts for the sequence of instructions that increments the
> value.
> 
> With such an approach incrementing the counter should be much safer. If
> the other arch want to avoid irq on/off sequences then they can override
> the fallback to use atomics or whatever the processor architecture permits
> to avoid the overhead of interrupt on / off.

Fair enough, but in this case I don't need it to be safe.

							Thanx, Paul

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