• Arnaldo Carvalho de Melo's avatar
    perf tools: Make the mmap length autotuning more robust · 1be300f4
    Arnaldo Carvalho de Melo authored
    If /proc/sys/kernel/perf_event_mlock_kb is not (power of 2 + PAGE_SIZE_in_kb)
    and we let the perf tools do mmap length autosizing based on that, then, for
    non-CAP_IPC_LOCK users when /proc/sys/kernel/perf_event_paranoid is > -1, then
    we get an -EINVAL that ends up in:
    
      [acme@ssdandy linux]$ trace usleep 1
      Invalid argument
      [acme@ssdandy linux]$ perf record usleep 1
      failed to mmap with 22 (Invalid argument)
    
    After this fix:
    
      [acme@ssdandy linux]$ trace usleep 1
      <SNIP>
       0.806 ( 0.006 ms): munmap(addr: 0x7f7e4740a000, len: 66467) = 0
       0.869 ( 0.002 ms): brk(                                   ) = 0x7bb000
       0.873 ( 0.003 ms): brk(brk: 0x7dc000                      ) = 0x7dc000
       0.877 ( 0.001 ms): brk(                                   ) = 0x7dc000
       0.953 ( 0.058 ms): nanosleep(rqtp: 0x7fff26ab9420         ) = 0
       0.959 ( 0.000 ms): exit_group(
      [acme@ssdandy linux]$ perf record usleep 1
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.017 MB perf.data (~759 samples) ]
      [acme@ssdandy linux]$
    
    Cc: Adrian Hunter <adrian.hunter@intel.com>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: David Ahern <dsahern@gmail.com>
    Cc: Don Zickus <dzickus@redhat.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Mike Galbraith <efault@gmx.de>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Link: http://lkml.kernel.org/n/tip-6p6l5ou6jev6o7ymc4nn1n2a@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    1be300f4
evlist.c 36 KB