patch-2.3.30 linux/include/asm-i386/smplock.h

Next file: linux/include/asm-i386/spinlock.h
Previous file: linux/include/asm-i386/smp.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.29/linux/include/asm-i386/smplock.h linux/include/asm-i386/smplock.h
@@ -38,6 +38,10 @@
  */
 extern __inline__ void lock_kernel(void)
 {
+#if 1
+	if (!++current->lock_depth)
+		spin_lock(&kernel_flag);
+#else
 	__asm__ __volatile__(
 		"incl %1\n\t"
 		"jne 9f"
@@ -45,12 +49,17 @@
 		"\n9:"
 		:"=m" (__dummy_lock(&kernel_flag)),
 		 "=m" (current->lock_depth));
+#endif
 }
 
 extern __inline__ void unlock_kernel(void)
 {
 	if (current->lock_depth < 0)
 		BUG();
+#if 1
+	if (--current->lock_depth < 0)
+		spin_unlock(&kernel_flag);
+#else
 	__asm__ __volatile__(
 		"decl %1\n\t"
 		"jns 9f\n\t"
@@ -58,4 +67,5 @@
 		"\n9:"
 		:"=m" (__dummy_lock(&kernel_flag)),
 		 "=m" (current->lock_depth));
+#endif
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)