lkml.org 
[lkml]   [1999]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectspin_unlock optimization(i386)
the current spin_unlock asm code is
"lock; btrl $0,%0"
it takes ~ 22 ticks on my PII/350.

I think it's possible to replace that with
"movl $0,%0"
which would be a simple, pairable single-tick instruction.

before spin_unlock(), spinlock_t.lock is _always_ 0x0000 0001, ie btrl
is identical to "movl $0,".
--> the only difference is the memory ordering effect of "lock;".

IA32 never reorders write operations, ie even without the "lock;" prefix
spin_unlock() is still a write memory barrier.
Few places will need the read memory barrier, and most of them should
use set_current_state() anyway.

--> What about defining that "spin_unlock()" is only a write memory
barrier and replacing "lock;btrl" with "mov"?

[I guess it's to late to change that for the 2.4 timeframe, but
release_kernel_lock() for i386 could be simplified, perhaps even
unlock_kernel()]

--
Manfred


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.053 / U:0.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site