Author: nwhitehorn
Date: Sun Apr 22 20:23:34 2012
New Revision: 234583
URL: http://svn.freebsd.org/changeset/base/234583

Log:
  On non-64-bit systems (which generally don't have lwsync), use eieio and
  isync to implement read and write barriers, following Appendix B.2 of
  Book II of the architecture manual. This provides a 25% speed increase
  to fork() on the PowerPC G4.

Modified:
  head/sys/powerpc/include/atomic.h

Modified: head/sys/powerpc/include/atomic.h
==============================================================================
--- head/sys/powerpc/include/atomic.h   Sun Apr 22 20:14:33 2012        
(r234582)
+++ head/sys/powerpc/include/atomic.h   Sun Apr 22 20:23:34 2012        
(r234583)
@@ -38,8 +38,13 @@
 
 /* NOTE: lwsync is equivalent to sync on systems without lwsync */
 #define mb()   __asm __volatile("lwsync" : : : "memory")
+#ifdef __powerpc64__
 #define wmb()  __asm __volatile("lwsync" : : : "memory")
 #define rmb()  __asm __volatile("lwsync" : : : "memory")
+#else
+#define wmb()  __asm __volatile("eieio" : : : "memory")
+#define rmb()  __asm __volatile("isync" : : : "memory")
+#endif
 
 /*
  * atomic_add(p, v)
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to