perf tools: Try to increase the file descriptor limits on EMFILE
commitbec196720431db2fd6a9b03cbd77eb336e6f52de
authorAndi Kleen <ak@linux.intel.com>
Mon, 5 Aug 2013 02:41:26 +0000 (4 19:41 -0700)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 16 Aug 2013 20:17:57 +0000 (16 17:17 -0300)
tree01f671397f4ba0e811cf6d3b244777e2d97f8d88
parentfe32ee0fc1c43f780529da79329d8c87ebc51464
perf tools: Try to increase the file descriptor limits on EMFILE

perf stat -a needs 10 open file descriptors per logical CPU
perf stat -a -dddd needs 20 open fds for each.

This implies that stat -a doesn't work on any system with the default
ulimit -n 1024 which has more than ~100 CPUs and stat -a -dddd doesn't
work on anything with more than 46 CPUs.

Longer term there needs to be probably some way to lower the file
descriptor requirements. This would need some changes in the kernel/user
interface.

But short term this patch just tries to increase the file descriptor
limit in perf itself, when it runs into a EMFILE.

It first sets it to the hard limit, and then tries to increase the hard
limit.

On Fedora systems the default seems to be soft limit 1024 and hard limit
4*1024. So even non root can support 409 or 186 CPUs respectively. root
can go far higher.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Link: http://lkml.kernel.org/r/1375670486-15480-1-git-send-email-andi@firstfloor.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/evsel.c