]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commit
[IA64] Spinlock optimizations
authorChristoph Lameter <clameter@sgi.com>
Fri, 5 Aug 2005 15:02:00 +0000 (08:02 -0700)
committerTony Luck <tony.luck@intel.com>
Wed, 10 Aug 2005 23:13:10 +0000 (16:13 -0700)
commitf521089158cd48a81b4d72e8e39da006dd79779b
treee5053eba17c84c64e2c86e67adefe56f3ef5ba10
parentbc68552faad0e134eb22281343d5ae5a4873fa80
[IA64] Spinlock optimizations

1. Nontemporal store for spin unlock.

A nontemporal store will not update the LRU setting for the cacheline. The
cacheline with the lock may therefore be evicted faster from the cpu
caches. Doing so may be useful since it increases the chance that the
exclusive cache line has been evicted when another cpu is trying to
acquire the lock.

The time between dropping and reacquiring a lock on the same cpu is
typically very small so the danger of the cacheline being
evicted is negligible.

2. Avoid semaphore operation in write_unlock and use nontemporal store

write_lock uses a cmpxchg like the regular spin_lock but write_unlock uses
clear_bit which requires a load and then a loop over a cmpxchg. The
following patch makes write_unlock simply use a nontemporal store to clear
the highest 8 bits. We will then still have the lower 3 bytes (24 bits)
left to count the readers.

Doing the byte store will reduce the number of possible readers from 2^31
to 2^24 = 16 million.

These patches were discussed already:

http://marc.theaimsgroup.com/?t=111472054400001&r=1&w=2
http://marc.theaimsgroup.com/?l=linux-ia64&m=111401837707849&w=2

The nontemporal stores will only work using GCC. If a compiler is used
that does not support inline asm then fallback C code is used. This
will preserve the byte store but not be able to do the nontemporal stores.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
include/asm-ia64/spinlock.h