Re: [patch 00/2] improve .text size on gcc 4.0 and newer compilers

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

 



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 [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