diff options
author | dillon <dillon@FreeBSD.org> | 1999-11-23 20:07:39 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 1999-11-23 20:07:39 +0000 |
commit | 892533638d4a03333aa25823e4d983593cdcc2b1 (patch) | |
tree | 0027cdb8231a5069b882e712a9558f5e80030cab /sys/i386 | |
parent | 3765f3c475ecd80158ab92b547ab32ef506a1707 (diff) | |
download | FreeBSD-src-892533638d4a03333aa25823e4d983593cdcc2b1.zip FreeBSD-src-892533638d4a03333aa25823e4d983593cdcc2b1.tar.gz |
Even better then using %fs:0 in our locked synchronizing instruction,
we instead use 0(%esp), which is per-cpu, already pretty much
guarenteed to be locked into the cache, and does not stress the cache's
set associativity. invlpg might also be a good choice (suggested by
Ingo).
Obtained from: Linus Torvalds <torvalds@transmeta.com>
Diffstat (limited to 'sys/i386')
-rw-r--r-- | sys/i386/i386/mplock.s | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/i386/i386/mplock.s b/sys/i386/i386/mplock.s index e679b5d..a37b14a 100644 --- a/sys/i386/i386/mplock.s +++ b/sys/i386/i386/mplock.s @@ -170,10 +170,11 @@ NON_GPROF_ENTRY(MPtrylock) * * We must force instruction serialization prior to releasing the MP lock for * the last time. 'cpuid' or a locked bus cycle will accomplish this. A - * locked bus cycle is the fastest solution. We use our per-cpu private - * memory area rather then the shared lock memory because we are more likely - * to already have exclusive access to the cache line (which is 3x faster - * then if we have to invalid another cpu's cache). + * locked bus cycle is the fastest solution. We use a memory location that + * we know we 'own' in our cache to provide for the fastest execution of the + * instruction, one that has no contention with other cpu's. 0(%esp) is + * perfect. It may also be possible to use invlpg for even more speed, + * but this will be less deterministic across processor families. */ NON_GPROF_ENTRY(MPrellock_edx) @@ -184,7 +185,7 @@ NON_GPROF_ENTRY(MPrellock_edx) ARB_HWI /* last release, arbitrate hw INTs */ movl $FREE_LOCK, %ecx /* - In which case we release it */ lock - addl $0,%fs:0 /* see note above */ + addl $0,0(%esp) /* see note above */ 2: movl %ecx, (%edx) ret |