Re: [PATCH -v7][RFC]: mutex: implement adaptive spinning

David Miller
2009-01-09T04:59:46Z

From: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu, 8 Jan 2009 19:46:30 -0800 (PST)

> First off, gcc _does_ have a perfectly fine notion of how heavy-weight an
> "asm" statement is: just count it as a single instruction (and count the
> argument setup cost that gcc _can_ estimate).

Actually, at least at one point, it counted the number of newline
characters in the assembly string to estimate how many instructions
are contained inside.

It actually needs to know exaclty how many instructions are in there,
to emit proper far branches and stuff like that, for some cpus.

Since they never added an (optional) way to actually tell the compiler
this critical piece of information, so I guess the newline hack is the
best they could come up with.