[PATCH] i386: Remove lock section support in semaphore.h
Lock sections don't work the new dwarf2 unwinder This generates slightly smaller code. It adds one more taken jump to the fast path. Cc: jbeulich@novell.com Signed-off-by: Andi Kleen <ak@suse.de>
This commit is contained in:
parent
add659bf8a
commit
7ca2b49b06
|
@ -100,13 +100,10 @@ static inline void down(struct semaphore * sem)
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"# atomic down operation\n\t"
|
"# atomic down operation\n\t"
|
||||||
LOCK_PREFIX "decl %0\n\t" /* --sem->count */
|
LOCK_PREFIX "decl %0\n\t" /* --sem->count */
|
||||||
"js 2f\n"
|
"jns 2f\n"
|
||||||
"1:\n"
|
"\tlea %0,%%eax\n\t"
|
||||||
LOCK_SECTION_START("")
|
"call __down_failed\n"
|
||||||
"2:\tlea %0,%%eax\n\t"
|
"2:"
|
||||||
"call __down_failed\n\t"
|
|
||||||
"jmp 1b\n"
|
|
||||||
LOCK_SECTION_END
|
|
||||||
:"+m" (sem->count)
|
:"+m" (sem->count)
|
||||||
:
|
:
|
||||||
:"memory","ax");
|
:"memory","ax");
|
||||||
|
@ -123,15 +120,12 @@ static inline int down_interruptible(struct semaphore * sem)
|
||||||
might_sleep();
|
might_sleep();
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"# atomic interruptible down operation\n\t"
|
"# atomic interruptible down operation\n\t"
|
||||||
|
"xorl %0,%0\n\t"
|
||||||
LOCK_PREFIX "decl %1\n\t" /* --sem->count */
|
LOCK_PREFIX "decl %1\n\t" /* --sem->count */
|
||||||
"js 2f\n\t"
|
"jns 2f\n\t"
|
||||||
"xorl %0,%0\n"
|
"lea %1,%%eax\n\t"
|
||||||
"1:\n"
|
"call __down_failed_interruptible\n"
|
||||||
LOCK_SECTION_START("")
|
"2:"
|
||||||
"2:\tlea %1,%%eax\n\t"
|
|
||||||
"call __down_failed_interruptible\n\t"
|
|
||||||
"jmp 1b\n"
|
|
||||||
LOCK_SECTION_END
|
|
||||||
:"=a" (result), "+m" (sem->count)
|
:"=a" (result), "+m" (sem->count)
|
||||||
:
|
:
|
||||||
:"memory");
|
:"memory");
|
||||||
|
@ -148,15 +142,12 @@ static inline int down_trylock(struct semaphore * sem)
|
||||||
|
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"# atomic interruptible down operation\n\t"
|
"# atomic interruptible down operation\n\t"
|
||||||
|
"xorl %0,%0\n\t"
|
||||||
LOCK_PREFIX "decl %1\n\t" /* --sem->count */
|
LOCK_PREFIX "decl %1\n\t" /* --sem->count */
|
||||||
"js 2f\n\t"
|
"jns 2f\n\t"
|
||||||
"xorl %0,%0\n"
|
"lea %1,%%eax\n\t"
|
||||||
"1:\n"
|
|
||||||
LOCK_SECTION_START("")
|
|
||||||
"2:\tlea %1,%%eax\n\t"
|
|
||||||
"call __down_failed_trylock\n\t"
|
"call __down_failed_trylock\n\t"
|
||||||
"jmp 1b\n"
|
"2:\n"
|
||||||
LOCK_SECTION_END
|
|
||||||
:"=a" (result), "+m" (sem->count)
|
:"=a" (result), "+m" (sem->count)
|
||||||
:
|
:
|
||||||
:"memory");
|
:"memory");
|
||||||
|
@ -166,22 +157,16 @@ static inline int down_trylock(struct semaphore * sem)
|
||||||
/*
|
/*
|
||||||
* Note! This is subtle. We jump to wake people up only if
|
* Note! This is subtle. We jump to wake people up only if
|
||||||
* the semaphore was negative (== somebody was waiting on it).
|
* the semaphore was negative (== somebody was waiting on it).
|
||||||
* The default case (no contention) will result in NO
|
|
||||||
* jumps for both down() and up().
|
|
||||||
*/
|
*/
|
||||||
static inline void up(struct semaphore * sem)
|
static inline void up(struct semaphore * sem)
|
||||||
{
|
{
|
||||||
__asm__ __volatile__(
|
__asm__ __volatile__(
|
||||||
"# atomic up operation\n\t"
|
"# atomic up operation\n\t"
|
||||||
LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
|
LOCK_PREFIX "incl %0\n\t" /* ++sem->count */
|
||||||
"jle 2f\n"
|
"jg 1f\n\t"
|
||||||
"1:\n"
|
"lea %0,%%eax\n\t"
|
||||||
LOCK_SECTION_START("")
|
"call __up_wakeup\n"
|
||||||
"2:\tlea %0,%%eax\n\t"
|
"1:"
|
||||||
"call __up_wakeup\n\t"
|
|
||||||
"jmp 1b\n"
|
|
||||||
LOCK_SECTION_END
|
|
||||||
".subsection 0\n"
|
|
||||||
:"+m" (sem->count)
|
:"+m" (sem->count)
|
||||||
:
|
:
|
||||||
:"memory","ax");
|
:"memory","ax");
|
||||||
|
|
Loading…
Reference in a new issue