]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86: Reduce stack usage of x86_schedule_events()
authorAndrew Hunter <ahh@google.com>
Thu, 23 May 2013 18:07:03 +0000 (11:07 -0700)
committerIngo Molnar <mingo@kernel.org>
Wed, 19 Jun 2013 10:50:44 +0000 (12:50 +0200)
commit715d5c69b2397a95fe3bfe5755a0e6ce9f24c421
treeece20f517fe07b2c58e56f2909e6516813511b12
parent2e33ea723c49ec63b4ba5e691e2c3125cf0599e1
perf/x86: Reduce stack usage of x86_schedule_events()

x86_schedule_events() caches event constraints on the stack during
scheduling.  Given the number of possible events, this is 512 bytes of
stack; since it can be invoked under schedule() under god-knows-what,
this is causing stack blowouts.

Trade some space usage for stack safety: add a place to cache the
constraint pointer to struct perf_event.  For 8 bytes per event (1% of
its size) we can save the giant stack frame.

This shouldn't change any aspect of scheduling whatsoever and while in
theory the locality's a tiny bit worse, I doubt we'll see any
performance impact either.

Tested: `perf stat whatever` does not blow up and produces
results that aren't hugely obviously wrong.  I'm not sure how to run
particularly good tests of perf code, but this should not produce any
functional change whatsoever.

Signed-off-by: Andrew Hunter <ahh@google.com>
Reviewed-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1369332423-4400-1-git-send-email-ahh@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/cpu/perf_event.c
arch/x86/kernel/cpu/perf_event.h
arch/x86/kernel/cpu/perf_event_intel_uncore.c
include/linux/perf_event.h