[lkml]   [2005]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/10] Cr4 is valid on some 486s

On Sun, 13 Nov 2005, Linus Torvalds wrote:
> The only question being whether you'd actually want to nop out the
> spinlock instructions _entirely_ (in addition to changing the nops on
> things like semaphores). Without the lock, they're not that expensive, but
> hey, it's still a useless (memory-modifying) instruction.

Actually, that may turn out to be a dangerous idea.

Sad but true: There's a few tests like

#define assert_spin_locked(x) BUG_ON(!spin_is_locked(x))


#define __raw_spin_unlock_wait(lock) \
do { while (__raw_spin_is_locked(lock)) cpu_relax(); } while (0)

that would also need to be nopped out if we nop out the code that updates
the spinlock (right now they are just disabled entirely on UP, exactly
because tests like this don't work without the lock being instantiated).

But it would be wonderful if we could just nop out the whole call to the
spinlock (most of them are out-of-line). It would help I$ footprint, and
likely help improve dynamic scheduling around that call on many CPU's too.

So we can easily remove the lock prefix on the spinlock ops, but sadly we
can't do some other "obvious" optimizations.

We _could_ nop out the actual conditional on the lock result for a
spinlock, and turn

lock ; decb %0
js ...


nop ; decb %0

which would help avoid some unnecessary branch prediction etc.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2009-11-18 23:46    [W:0.105 / U:2.604 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site