Limit perf data buffer during profiling

With high -j parallelism the autofdo tests can randomly fail.
autofdo uses Linux perf to record profiling data.
Linux perf uses a locked perf buffer. By default it has
around 516k buffer per uid (/proc/sys/kernel/perf_event_mlock_kb).

An individual perf record tries to grab the full 516k,
which makes parallel perf record fail.

This patch limits the perf buffer for individual perf record to 8k.
With the default settings this allows a parallelism of the test
cases of 16, which is hopefully good enough

(if not would need to add some kind of semaphore, or ask
the user to increase the limit as root)

I also removed an unneeded -o perf.data option

Thanks to Marcin to finally spotting the problem.

Passes bootstrap and test on x86_64-linux. Ok for trunk?

gcc/testsuite/:

2017-05-12  Andi Kleen  <ak@linux.intel.com>

	PR testsuite/77684
	* lib/target-supports.exp (profopt-perf-wrapper):
	Add -m8 option to increase parallelism.

From-SVN: r247962
This commit is contained in:
Andi Kleen 2017-05-12 10:09:50 +00:00 committed by Andi Kleen
parent 1e47f02b63
commit 2ead1ab911
2 changed files with 14 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2017-05-12 Andi Kleen <ak@linux.intel.com>
PR testsuite/77684
* lib/target-supports.exp (profopt-perf-wrapper):
Add -m8 option to increase parallelism.
2017-05-12 Thomas Schwinge <thomas@codesourcery.com>
* c-c++-common/goacc/parallel-dims-1.c: New file.

View File

@ -522,9 +522,16 @@ proc check_effective_target_keeps_null_pointer_checks { } {
# Return the autofdo profile wrapper
# Linux by default allows 516KB of perf event buffers
# in /proc/sys/kernel/perf_event_mlock_kb
# Each individual perf tries to grab it
# This causes problems with parallel test suite runs. Instead
# limit us to 8 pages (32K), which should be good enough
# for the small test programs. With the default settings
# this allows parallelism of 16 and higher of parallel gcc-auto-profile
proc profopt-perf-wrapper { } {
global srcdir
return "$srcdir/../config/i386/gcc-auto-profile -o perf.data "
return "$srcdir/../config/i386/gcc-auto-profile -o perf.data -m8 "
}
# Return true if profiling is supported on the target.