From: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
To: acme@ghostprotocols.net
Cc: mingo@elte.hu, Yanmin Zhang <yanmin_zhang@linux.intel.com>,
linux kernel mailing list <linux-kernel@vger.kernel.org>,
a.p.zijlstra@chello.nl, paulus@samba.org
Subject: Re: [PATCH] perf: close the opened directories.
Date: Thu, 24 Jun 2010 14:16:15 +0800 [thread overview]
Message-ID: <4C22F82F.10106@cn.fujitsu.com> (raw)
In-Reply-To: <4C1C3F7C.4030607@cn.fujitsu.com>
Gui Jianfeng wrote:
> When I ran "perf kvm ... top", I encountered the following error output.
>
> Error: perfcounter syscall returned with -1 (Too many open files)
>
> Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
>
> Looking into perf, I found perf opens too many direcotries at initialization
> time, but forgets to close them. Here is the fix.
Ping.
>
> Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
> ---
> tools/perf/util/symbol.c | 18 +++++++++++-------
> 1 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> index 7fd6b15..a00dcad 100644
> --- a/tools/perf/util/symbol.c
> +++ b/tools/perf/util/symbol.c
> @@ -1443,6 +1443,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
> {
> struct dirent *dent;
> DIR *dir = opendir(dir_name);
> + int ret = 0;
>
> if (!dir) {
> pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
> @@ -1465,8 +1466,10 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
>
> snprintf(path, sizeof(path), "%s/%s",
> dir_name, dent->d_name);
> - if (map_groups__set_modules_path_dir(self, path) < 0)
> - goto failure;
> + if (map_groups__set_modules_path_dir(self, path) < 0) {
> + ret = -1;
> + goto out;
> + }
> } else {
> char *dot = strrchr(dent->d_name, '.'),
> dso_name[PATH_MAX];
> @@ -1487,17 +1490,18 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
> dir_name, dent->d_name);
>
> long_name = strdup(path);
> - if (long_name == NULL)
> - goto failure;
> + if (long_name == NULL) {
> + ret = -1;
> + goto out;
> + }
> dso__set_long_name(map->dso, long_name);
> dso__kernel_module_get_build_id(map->dso, "");
> }
> }
>
> - return 0;
> -failure:
> +out:
> closedir(dir);
> - return -1;
> + return ret;
> }
>
> static char *get_kernel_version(const char *root_dir)
next prev parent reply other threads:[~2010-06-24 6:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-19 3:54 [PATCH] perf: close the opened directories Gui Jianfeng
2010-06-24 6:16 ` Gui Jianfeng [this message]
2010-06-24 6:29 ` Zhang, Yanmin
2010-06-24 6:49 ` Gui Jianfeng
2010-06-24 7:04 ` [PATCH v2] " Gui Jianfeng
2010-06-24 7:21 ` Peter Zijlstra
2010-06-24 13:52 ` Arnaldo Carvalho de Melo
2010-07-16 7:37 ` Gui Jianfeng
2010-07-16 15:42 ` Arnaldo Carvalho de Melo
2010-07-17 11:11 ` [tip:perf/urgent] perf symbols: Fix directory descriptor leaking tip-bot for Gui Jianfeng
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=4C22F82F.10106@cn.fujitsu.com \
--to=guijianfeng@cn.fujitsu.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=yanmin_zhang@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).