Re: [PATCH 1/10] Cr4 is valid on some 486s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux