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]
Message-ID: <alpine.DEB.2.00.1012021604330.5395@router.home>
Date:	Thu, 2 Dec 2010 16:06:15 -0600 (CST)
From:	Christoph Lameter <cl@...ux.com>
To:	akpm@...ux-foundation.org
cc:	Pekka Enberg <penberg@...helsinki.fi>,
	linux-kernel@...r.kernel.org,
	Eric Dumazet <eric.dumazet@...il.com>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
	Tejun Heo <tj@...nel.org>
Subject: [rfc: cpuops adv V1 2/8] Fallback to atomic xchg, cmpxchg

Sorry this should have been:

Subject: this_cpu_xchg/cmpxchg: Fall back to atomic xchg, cmpxchg

It may be better if we fall back to the full operation instead of
simulation through irq disable etc.

Signed-off-by: Christoph Lameter <cl@...ux.com>

---
 include/linux/percpu.h |   31 +++----------------------------
 1 file changed, 3 insertions(+), 28 deletions(-)

Index: linux-2.6/include/linux/percpu.h
===================================================================
--- linux-2.6.orig/include/linux/percpu.h	2010-12-02 12:17:14.000000000 -0600
+++ linux-2.6/include/linux/percpu.h	2010-12-02 12:17:30.000000000 -0600
@@ -361,14 +361,7 @@ do {									\
 # define __this_cpu_xchg(pcp, nval)	__pcpu_size_call_return2(__this_cpu_xchg_, (pcp), nval)
 #endif

-#define _this_cpu_generic_xchg(pcp, nval)				\
-({	typeof(pcp) ret__;						\
-	preempt_disable();						\
-	ret__ = __this_cpu_read(pcp);					\
-	__this_cpu_write(pcp, nval);					\
-	preempt_enable();						\
-	ret__;								\
-})
+#define _this_cpu_generic_xchg(pcp, nval)	xchg(__this_cpu_ptr(&(pcp)), nval)

 #ifndef this_cpu_xchg
 # ifndef this_cpu_xchg_1
@@ -386,15 +379,7 @@ do {									\
 # define this_cpu_xchg(pcp, nval)	__pcpu_size_call_return2(this_cpu_xchg_, (pcp), nval)
 #endif

-#define _this_cpu_generic_cmpxchg(pcp, oval, nval)			\
-({	typeof(pcp) ret__;						\
-	preempt_disable();						\
-	ret__ = __this_cpu_read(pcp);					\
-	if (ret__ == (oval))						\
-		__this_cpu_write(pcp, nval);				\
-	preempt_enable();						\
-	ret__;								\
-})
+#define _this_cpu_generic_cmpxchg(pcp, oval, nval)	cmpxchg(__this_cpu_ptr(&(pcp)), oval, nval);

 #ifndef this_cpu_cmpxchg
 # ifndef this_cpu_cmpxchg_1
@@ -892,17 +877,7 @@ do {									\
 # define irqsafe_cpu_xor(pcp, val) __pcpu_size_call(irqsafe_cpu_xor_, (val))
 #endif

-#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)			\
-({									\
-	typeof(pcp) ret__;						\
-	unsigned long flags;						\
-	local_irq_save(flags);						\
-	ret__ = __this_cpu_read(pcp);					\
-	if (ret__ == (oval))						\
-		__this_cpu_write(pcp, nval);				\
-	local_irq_restore(flags);					\
-	ret__;								\
-})
+#define irqsafe_cpu_generic_cmpxchg(pcp, oval, nval)	cmpxchg(__this_cpu_ptr(&(pcp), oval, nval)

 #ifndef irqsafe_cpu_cmpxchg
 # ifndef irqsafe_cpu_cmpxchg_1
--
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