Messages in this thread | | | Date | Tue, 29 Mar 2011 08:24:13 +0200 | From | Ingo Molnar <> | Subject | Re: [PATCH 5/6] x86-64: Omit frame pointers on vread_tsc |
| |
* Andy Lutomirski <luto@MIT.EDU> wrote:
> vread_tsc is short and hot, and it's userspace code so the usual > reasons to keep frame pointers around don't apply. > > Signed-off-by: Andy Lutomirski <luto@mit.edu> > --- > > It might be nicer to move vread_tsc into a separate file and change > the options directly. > > arch/x86/kernel/tsc.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c > index a159fba..1aea4a6 100644 > --- a/arch/x86/kernel/tsc.c > +++ b/arch/x86/kernel/tsc.c > @@ -764,6 +764,8 @@ static cycle_t read_tsc(struct clocksource *cs) > } > > #ifdef CONFIG_X86_64 > +#pragma GCC push_options > +#pragma GCC optimize ("omit-frame-pointer") > static cycle_t __vsyscall_fn vread_tsc(void) > { > cycle_t ret; > @@ -807,6 +809,7 @@ static cycle_t __vsyscall_fn vread_tsc(void) > asm volatile (""); > return last; > } > +#pragma GCC pop_options > #endif
The cleaner option would be to put the __vsyscall functions into a new .c file and build it with framepointers off in the Makefile, which can be done via:
CFLAGS_vtsc.o := -fno-omit-frame-pointer
or so.
We could also consider putting this function into a .S too. Not sure it works out in a maintainable fashion though.
Thanks,
Ingo
| |