summaryrefslogtreecommitdiff
path: root/include/asm-x86_64/semaphore.h
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 12:52:32 +0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 12:52:32 +0400
commit8578bdf835d6d6ece6718858d351456367b8a5cf (patch)
tree5bf4aa72bda1f5c508d955a2d32b5d292f8bd5a7 /include/asm-x86_64/semaphore.h
parent7ca2b49b06a6d26e89e3535653889f1d7892b085 (diff)
downloadlinux-8578bdf835d6d6ece6718858d351456367b8a5cf.tar.xz
[PATCH] Don't use lock section for mutexes and semaphores
Lock sections cannot be handled by the dwarf2 unwinder. Disadvantage is a taken branch in the hot path. Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'include/asm-x86_64/semaphore.h')
-rw-r--r--include/asm-x86_64/semaphore.h40
1 files changed, 14 insertions, 26 deletions
diff --git a/include/asm-x86_64/semaphore.h b/include/asm-x86_64/semaphore.h
index 064df08b9a0f..107bd90429e8 100644
--- a/include/asm-x86_64/semaphore.h
+++ b/include/asm-x86_64/semaphore.h
@@ -107,12 +107,9 @@ static inline void down(struct semaphore * sem)
__asm__ __volatile__(
"# atomic down operation\n\t"
LOCK_PREFIX "decl %0\n\t" /* --sem->count */
- "js 2f\n"
- "1:\n"
- LOCK_SECTION_START("")
- "2:\tcall __down_failed\n\t"
- "jmp 1b\n"
- LOCK_SECTION_END
+ "jns 1f\n\t"
+ "call __down_failed\n"
+ "1:"
:"=m" (sem->count)
:"D" (sem)
:"memory");
@@ -130,14 +127,11 @@ static inline int down_interruptible(struct semaphore * sem)
__asm__ __volatile__(
"# atomic interruptible down operation\n\t"
+ "xorl %0,%0\n\t"
LOCK_PREFIX "decl %1\n\t" /* --sem->count */
- "js 2f\n\t"
- "xorl %0,%0\n"
- "1:\n"
- LOCK_SECTION_START("")
- "2:\tcall __down_failed_interruptible\n\t"
- "jmp 1b\n"
- LOCK_SECTION_END
+ "jns 2f\n\t"
+ "call __down_failed_interruptible\n"
+ "2:\n"
:"=a" (result), "=m" (sem->count)
:"D" (sem)
:"memory");
@@ -154,14 +148,11 @@ static inline int down_trylock(struct semaphore * sem)
__asm__ __volatile__(
"# atomic interruptible down operation\n\t"
+ "xorl %0,%0\n\t"
LOCK_PREFIX "decl %1\n\t" /* --sem->count */
- "js 2f\n\t"
- "xorl %0,%0\n"
- "1:\n"
- LOCK_SECTION_START("")
- "2:\tcall __down_failed_trylock\n\t"
- "jmp 1b\n"
- LOCK_SECTION_END
+ "jns 2f\n\t"
+ "call __down_failed_trylock\n\t"
+ "2:\n"
:"=a" (result), "=m" (sem->count)
:"D" (sem)
:"memory","cc");
@@ -179,12 +170,9 @@ static inline void up(struct semaphore * sem)
__asm__ __volatile__(
"# atomic up operation\n\t"
LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
- "jle 2f\n"
- "1:\n"
- LOCK_SECTION_START("")
- "2:\tcall __up_wakeup\n\t"
- "jmp 1b\n"
- LOCK_SECTION_END
+ "jg 1f\n\t"
+ "call __up_wakeup\n"
+ "1:"
:"=m" (sem->count)
:"D" (sem)
:"memory");