All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <jolsa@redhat.com>
To: Wang YanQing <udknight@gmail.com>,
	acme@redhat.com, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf:util:dso: Using O_CLOEXEC in do_open
Date: Thu, 18 Jan 2018 10:45:14 +0100	[thread overview]
Message-ID: <20180118094514.GC5947@krava> (raw)
In-Reply-To: <20180115050448.GA20759@udknight>

On Mon, Jan 15, 2018 at 01:04:48PM +0800, Wang YanQing wrote:
> I meet strange behavior with below 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:
> "
> 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 find out the reason is "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>

thanks,
jirka

> ---
>  tools/perf/util/dso.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
> index d5b6f7f..36ef45b 100644
> --- a/tools/perf/util/dso.c
> +++ b/tools/perf/util/dso.c
> @@ -446,7 +446,7 @@ static int do_open(char *name)
>  	char sbuf[STRERR_BUFSIZE];
>  
>  	do {
> -		fd = open(name, O_RDONLY);
> +		fd = open(name, O_RDONLY|O_CLOEXEC);
>  		if (fd >= 0)
>  			return fd;
>  
> -- 
> 1.8.5.6.2.g3d8a54e.dirty

  parent reply	other threads:[~2018-01-18  9:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15  5:04 [PATCH] perf:util:dso: Using O_CLOEXEC in do_open Wang YanQing
2018-01-15  9:45 ` Jiri Olsa
2018-01-16 16:55   ` Wang YanQing
2018-01-18  9:45 ` Jiri Olsa [this message]
2018-01-24 11:22 ` [tip:perf/core] perf symbols: " tip-bot for Wang YanQing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180118094514.GC5947@krava \
    --to=jolsa@redhat.com \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=udknight@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.