lkml.org 
[lkml]   [2012]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] tracepoints: Move the work out of line from hotpath sections
* Steven Rostedt (rostedt@goodmis.org) wrote:
> On Thu, 2012-08-09 at 16:54 -0700, David Daney wrote:
> > On 08/09/2012 04:16 PM, H. Peter Anvin wrote:
> > > On 08/09/2012 03:25 PM, Steven Rostedt wrote:
> > >>>
> > >>> It might be better to improve gcc to move really cold branches out of
> > >>> line (really, really far away), and use the compiler to do this, rather
> > >>> than to use an extra indirection that adds bloat and complexity to the
> > >>> kernel.
> >
> > Oh, you mean like: -freorder-blocks-and-partition
>
> Actually, what would be really nice is to place a block in a section of
> your choice. Something like:
>
>
> if (unlikely(x)) __attribute__((section(".unlikely"))) {
> /* code here will be in the ".unlikely" section */
> }

In your example, is the attribute attached to the if() or the following
basic block ? Attaching it to the basic block allows a nice level of
genericity:

if (unlikely(x)) __attribute__((section(".unlikely"))) {
...
} else __attribute__((section(".likely"))) {
...
}

or

switch (x) {
case 0:
case 1:
case 6:
__attribute__((section(".likely"))) {
...
break;
}
default:
__attribute__((section(".unlikely"))) {
...
break;
}
}

Thanks,

Mathieu

>
> -- Steve
>
>

--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com


\
 
 \ /
  Last update: 2012-08-10 04:42    [W:2.334 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site