Skip to contentSkip to conversation

fix i386 mutex fastpath on FRAME_POINTER && !DEBUG_MUTEXES

PATCH Chuck Ebbert 2 participants 2 messages Jan 11, 2006

lore
Share & tools
lore
#0 lore raw

In-Reply-To: <[email protected]>

Quoted 7 lines · Ingo Molnar
include/asm-i386/mutex.h +0 -1
@@ -28,7 +28,13 @@ do {                                                                       \
                                                                      \
      __asm__ __volatile__(                                           \
              LOCK    "   decl (%%eax)        \n"                     \
-                     "   js "#fail_fn"       \n"                     \

include/asm-i386/mutex.h do { \ · line 40

Quoted 10 lines
include/asm-i386/mutex.h +7 -0
+                     "   js 2f               \n"                     \
+                     "1:                     \n"                     \
+                                                                     \
+             LOCK_SECTION_START("")                                  \
+                     "2: call "#fail_fn"     \n"                     \
+                     "   jmp 1b              \n"                     \
+             LOCK_SECTION_END                                        \
                                                                      \
              :"=a" (dummy)                                           \
              : "a" (count)                                           \

But now it's inefficient again.

Why not this:

                LOCK    "   decl (%%eax)        \n"                     \
                        "   jns 1f              \n"                     \
                        "   call "#fail_fn"     \n"                     \
                        "1:                     \n"                     \
                                                                        \
                :"=a" (dummy)                                           \
                : "a" (count)                                           \

Will the extra taken forward conditional jump in the fastpath cause much of a slowdown?

Signature · 2 lines
Chuck
Currently reading: _Olympos_ by Dan Simmons
#1 lore raw
Quoted 36 lines · Chuck Ebbert

In-Reply-To: <[email protected]>

Quoted 7 lines · Ingo Molnar
include/asm-i386/mutex.h +0 -1
@@ -28,7 +28,13 @@ do {                                                                       \
                                                                      \
      __asm__ __volatile__(                                           \
              LOCK    "   decl (%%eax)        \n"                     \
-                     "   js "#fail_fn"       \n"                     \

include/asm-i386/mutex.h do { \ · line 40

Quoted 10 lines
include/asm-i386/mutex.h +7 -0
+                     "   js 2f               \n"                     \
+                     "1:                     \n"                     \
+                                                                     \
+             LOCK_SECTION_START("")                                  \
+                     "2: call "#fail_fn"     \n"                     \
+                     "   jmp 1b              \n"                     \
+             LOCK_SECTION_END                                        \
                                                                      \
              :"=a" (dummy)                                           \
              : "a" (count)                                           \

But now it's inefficient again.

Why not this:

                LOCK    "   decl (%%eax)        \n"                     \
                        "   jns 1f              \n"                     \
                        "   call "#fail_fn"     \n"                     \
                        "1:                     \n"                     \
                                                                        \
                :"=a" (dummy)                                           \
                : "a" (count)                                           \
Quoted 2 lines

Will the extra taken forward conditional jump in the fastpath cause much of a slowdown?

yeah - the fastpath is much more common than the slowpath.

Ingo