Commit 5e163a89 authored by Manfred Spraul's avatar Manfred Spraul Committed by Linus Torvalds

[PATCH] reorder 'rep;nop;' in the spinlock macro

According to Intel's recommendation, 'rep;nop; should be called before
testing if the lock variable was modified (i.e. rep nop;cmp;jcc). The
current implementation does it the wrong way around: first test, then
wait, then branch. I've asked Asit Mallik from Intel, and he recommended
to change it.

It should be at least consistent: Right now, spinlock uses
'cmp;rep nop;jcc', rwlock uses 'rep nop;cmp;jcc'
parent d21918b6
...@@ -48,8 +48,8 @@ typedef struct { ...@@ -48,8 +48,8 @@ typedef struct {
"js 2f\n" \ "js 2f\n" \
LOCK_SECTION_START("") \ LOCK_SECTION_START("") \
"2:\t" \ "2:\t" \
"cmpb $0,%0\n\t" \
"rep;nop\n\t" \ "rep;nop\n\t" \
"cmpb $0,%0\n\t" \
"jle 2b\n\t" \ "jle 2b\n\t" \
"jmp 1b\n" \ "jmp 1b\n" \
LOCK_SECTION_END LOCK_SECTION_END
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment