patch-2.1.51 linux/include/asm-sparc64/semaphore.h

Next file: linux/include/asm-sparc64/shmparam.h
Previous file: linux/include/asm-sparc64/sbus.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.50/linux/include/asm-sparc64/semaphore.h linux/include/asm-sparc64/semaphore.h
@@ -38,20 +38,28 @@
 
 extern __inline__ void down(struct semaphore * sem)
 {
-	if (atomic_dec_return(&sem->count) < 0)
+	int result;
+
+	result = atomic_dec_return(&sem->count);
+	membar("#StoreLoad | #StoreStore");
+	if (result < 0)
 		__down(sem);
 }
 
 extern __inline__ int down_interruptible(struct semaphore *sem)
 {
-	int ret = 0;
-	if (atomic_dec_return(&sem->count) < 0)
+	int result, ret = 0;
+
+	result = atomic_dec_return(&sem->count);
+	membar("#StoreLoad | #StoreStore");
+	if (result < 0)
 		ret = __down_interruptible(sem);
 	return ret;
 }
 
 extern __inline__ void up(struct semaphore * sem)
 {
+	membar("#StoreStore | #LoadStore");
 	if (atomic_inc_return(&sem->count) <= 0)
 		__up(sem);
 }	

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov