This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[RFC] gcc feature request: Moving blocks into sections
- From: Steven Rostedt <rostedt at goodmis dot org>
- To: LKML <linux-kernel at vger dot kernel dot org>, gcc <gcc at gcc dot gnu dot org>
- Cc: Linus Torvalds <torvalds at linux-foundation dot org>, Ingo Molnar <mingo at kernel dot org>, Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>, "H. Peter Anvin" <hpa at linux dot intel dot com>, Thomas Gleixner <tglx at linutronix dot de>, David Daney <ddaney dot cavm at gmail dot com>, Behan Webster <behanw at converseincode dot com>, Peter Zijlstra <peterz at infradead dot org>
- Date: Mon, 05 Aug 2013 12:55:15 -0400
- Subject: [RFC] gcc feature request: Moving blocks into sections
[ sent to both Linux kernel mailing list and to gcc list ]
I was looking at some of the old code I still have marked in my TODO
list, that I never pushed to get mainlined. One of them is to move trace
point logic out of the fast path to get rid of the stress that it
imposes on the icache.
Almost a full year ago, Mathieu suggested something like:
if (unlikely(x)) __attribute__((section(".unlikely"))) {
...
} else __attribute__((section(".likely"))) {
...
}
https://lkml.org/lkml/2012/8/9/658
Which got me thinking. How hard would it be to set a block in its own
section. Like what Mathieu suggested, but it doesn't have to be
".unlikely".
if (x) __attibute__((section(".foo"))) {
/* do something */
}
Then have in the assembly, simply:
test x
beq 2f
1:
/* continue */
ret
2:
jmp foo1
3:
jmp 1b
Then in section ".foo":
foo1:
/* do something */
jmp 3b
Perhaps we can't use the section attribute. We could create a new
attribute. Perhaps a __jmp_section__ or whatever (I'm horrible with
names).
Is this a possibility?
If this is possible, we can get a lot of code out of the fast path.
Things like stats and tracing, which is mostly default off. I would
imagine that we would get better performance by doing this. Especially
as tracepoints are being added all over the place.
Thanks,
-- Steve