]> asedeno.scripts.mit.edu Git - linux.git/commit
perf symbols: Using O_CLOEXEC in do_open
authorWang YanQing <udknight@gmail.com>
Mon, 15 Jan 2018 05:04:48 +0000 (13:04 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 23 Jan 2018 12:49:28 +0000 (09:49 -0300)
commit4c0d8d27954d9efb2a02ec9fc16f39b02f248bb7
tree644129db3a29b75544c6b4fe99ff8b0f52b2b4ed
parent5c61d70e55ab1cb917752f4a0d5f4683b4869e32
perf symbols: Using O_CLOEXEC in do_open

I've meet a strange behavior with these commands on my gentoo box:

1: perf kmem record
2: CTRL-C to stop 1
3: perf report
4: "Enter", "Enter", "Run scripts for all samples",
   "event_analyzing_sample".

Then 'perf report' says:

  "
  No kallsyms or vmlinux with build-id xxxx was found
  /lib/modules/4.10.0+/build/vmlinux with build id xxxx not found,
  continuing without symbols
  ".

It is strange because I am sure /lib/modules/4.10.0+/build/vmlinux is
right for perf.data.

After digging, I found out the reason is that "perf report" generates
many open fds, then "script_browse" uses popen to run "perf script"
which run out of open files.

The gentoo box has a small default value for "max open files", 1024.
Yes, "ulimit -n " with a bigger number could fix it, but I think that
using O_CLOEXEC in do_open is a better way.

Signed-off-by: Wang YanQing <udknight@gmail.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20180115050448.GA20759@udknight
[ Make sure O_CLOEXEC is available in old systems by adding a patch
  just before this one, to keep this bisectable in such systems ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/dso.c