lkml.org 
[lkml]   [2006]   [Jan]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 00/2] improve .text size on gcc 4.0 and newer compilers
Martin Bligh wrote:
> But we were just discussing here ... wouldn't it be worth moving
> "unlikely" sections of code completely out of line? If they were calls
> to separate functions, all this optimisation stuff could just work at a
> function level, and would be pretty trivial to do?

...assuming that they don't need to access many local variables. And don't
have any "goto" statements... and... etc, etc.

> we'd have
>
> if (unlikely(conditon)) {
> call_oh_shit();
> }
>
> __rarely_called void call_oh_shit()
> {
> do;
> some;
> stuff;
> BUG();
> error();
> oh_dear();
> }

As I described in my other mail on this thread, the _ideal_ solution would
be to tell the compiler that BUG() is a __rarely_called function (well, it's
a macro now but it could be made into an inline function) and let the
compiler figure the rest out without further annotation

> Moving that out of line would seem
> to make more difference to icache footprint to me than just cacheline
> packing functions.

Assuming "-funit-at-a-time" (which all archs will probably be using soon)
you'd probably get exactly the same opcodes either way.

-Mitch
-
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: 2006-01-06 02:51    [W:0.105 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site