perf: close the opened directories.
PATCH 1/1 perf: close the opened directories.
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.
--- tools/perf/util/symbol.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)
tools/perf/util/symbol.c +11 -7
@@ -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)
Signature · 1 line
1.6.5.2
Quoted 8 lines · Gui Jianfeng
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=ykernel 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.
Quoted 55 lines
Signed-off-by Gui Jianfeng <[email protected]>--- tools/perf/util/symbol.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)tools/perf/util/symbol.c +11
-7@@ -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)
Quoted 8 lines · Gui Jianfeng
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=ykernel support configured?Looking into perf, I found perf opens too many direcotries at initialization time, but forgets to close them. Here is the fix.
Good catch!
Quoted 19 lines
Signed-off-by Gui Jianfeng <[email protected]>--- tools/perf/util/symbol.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)tools/perf/util/symbol.c +1
-0@@ -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);
tools/perf/util/symbol.c static int map_groups__set_modules_path_dir(struct map_groups *self, · line 1472
Quoted 9 lines
tools/perf/util/symbol.c +4
-2@@ -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; + }
How about changing above to:
ret = map_groups__set_modules_path_dir(self, path); if (ret < 0) goto out;
Quoted 27 lines
tools/perf/util/symbol.c +6
-5}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)
Quoted 39 lines · Yanmin
Quoted 8 lines · Gui Jianfeng
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=ykernel support configured?Looking into perf, I found perf opens too many direcotries at initialization time, but forgets to close them. Here is the fix.
Good catch!
Quoted 18 lines
Signed-off-by Gui Jianfeng <[email protected]>--- tools/perf/util/symbol.c | 18 +++++++++++------- 1 files changed, 11 insertions(+), 7 deletions(-)tools/perf/util/symbol.c +1
-0@@ -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);tools/perf/util/symbol.c static int map_groups__set_modules_path_dir(struct map_groups *self, · line 1472
Quoted 9 lines
tools/perf/util/symbol.c +4
-2@@ -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; + }How about changing above to:
Quoted 3 lines
ret = map_groups__set_modules_path_dir(self, path); if (ret < 0) goto out;
Sure, will change.
Thanks,
Gui
Quoted 34 lines
Quoted 30 lines
tools/perf/util/symbol.c +6
-5}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)
PATCH v2 1/1 perf: close the opened directories.
In reply to Zhang, YanminWhen 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.
--- tools/perf/util/symbol.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
tools/perf/util/symbol.c +10 -7
@@ -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,9 @@ 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; + ret =map_groups__set_modules_path_dir (self, path); +if (ret <0 ) + goto out; }else {char *dot =strrchr (dent->d_name,'.' ), dso_name[PATH_MAX ];
@@ -1487,17 +1489,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)
Signature · 1 line
1.6.5.2
Peter Zijlstra
maintainerQuoted 10 lines · Gui Jianfeng
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=ykernel support configured?Looking into perf, I found perf opens too many direcotries at initialization time, but forgets to close them. Here is the fix.
Signef-off-by Gui Jianfeng <[email protected]>
Looks good to me, Arnaldo, will you pick this up?
Em Thu, Jun 24, 2010 at 03:04:02PM +0800, Gui Jianfeng escreveu:
Quoted 10 lines
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=ykernel support configured?Looking into perf, I found perf opens too many direcotries at initialization time, but forgets to close them. Here is the fix.
Signef-off-by Gui Jianfeng <[email protected]>
Thanks, will apply.
- Arnaldo
Quoted 5 lines · Arnaldo Carvalho de Melo
Em Thu, Jun 24, 2010 at 03:04:02PM +0800, Gui Jianfeng escreveu:
Quoted 4 lines
When I ran "perf kvm ... top", I encountered the following error output.
Error: perfcounter syscall returned with -1 (Too many open files)
Quoted 8 lines
Quoted 6 lines
Fatal: No
CONFIG_PERF_EVENTS=ykernel support configured?Looking into perf, I found perf opens too many direcotries at initialization time, but forgets to close them. Here is the fix.
Signef-off-by Gui Jianfeng <[email protected]>Thanks, will apply.
Hi Arnaldo,
Would you pick up this fix?
Thanks,
Gui
Quoted 4 lines
- Arnaldo
Em Fri, Jul 16, 2010 at 03:37:07PM +0800, Gui Jianfeng escreveu:
Quoted 11 lines
Quoted 10 lines · Arnaldo Carvalho de Melo
Em Thu, Jun 24, 2010 at 03:04:02PM +0800, Gui Jianfeng escreveu:
Quoted 9 lines
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=ykernel support configured?Looking into perf, I found perf opens too many direcotries at initialization time, but forgets to close them. Here is the fix.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signef-off-by Gui Jianfeng <[email protected]>Thanks, will apply.
Hi Arnaldo,
Would you pick up this fix?
It was already, no? Nope, I thought about that other one about . and .., will apply.
- Arnaldo
[tip:perf/urgent] perf symbols: Fix directory descriptor leaking
In reply to Gui JianfengCommit-ID: 74534341c1214ac5993904680616afe698dde3b6 Gitweb: http://git.kernel.org/tip/74534341c1214ac5993904680616afe698dde3b6 Author: Gui Jianfeng <[email protected]> AuthorDate: Thu, 24 Jun 2010 15:04:02 +0800 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Fri, 16 Jul 2010 14:16:47 -0300
perf symbols: Fix directory descriptor leaking
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 directories at initialization time, but forgets to close them. Here is the fix.
LKML-Reference: <[email protected]>
--- tools/perf/util/symbol.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
tools/perf/util/symbol.c +10 -7
@@ -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,9 @@ 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; + ret =map_groups__set_modules_path_dir (self, path); +if (ret <0 ) + goto out; }else {char *dot =strrchr (dent->d_name,'.' ), dso_name[PATH_MAX ];
@@ -1487,17 +1489,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)