• Andi Kleen's avatar
    perf tools: Try to increase the file descriptor limits on EMFILE · bec19672
    Andi Kleen authored
    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: default avatarAndi Kleen <ak@linux.intel.com>
    Link: http://lkml.kernel.org/r/1375670486-15480-1-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    bec19672
evsel.c 37.9 KB