Re: [PATCH] x86: Implement __WARN using UD0

From: Arjan van de Ven
Date: Thu Feb 23 2017 - 09:14:57 EST


On 2/23/2017 5:28 AM, Peter Zijlstra wrote:

By using "UD0" for WARNs we remove the function call and its possible
__FILE__ and __LINE__ immediate arguments from the instruction stream.

Total image size will not change much, what we win in the instruction
stream we'll loose because of the __bug_table entries. Still, saves on
I$ footprint and the total image size does go down a bit.

well I am a little sceptical; WARNs are rare so the code (other than the test)
should be waaay out of line already (unlikely() and co).
And I assume you're not removing the __FILE__ and __LINE__ info, since that info
is actually high value for us developers... so what are you actually saving?

(icache saving is only real if the line that the cold code lives on would actually
end up in icache for other reasons; I would hope the compiler puts the out
of line code WAY out of line)