lkml.org 
[lkml]   [2005]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
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))

and

#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 ...

into

nop ; decb %0
multi-byte-nop

which would help avoid some unnecessary branch prediction etc.

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

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