diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-06-15 10:17:12 +0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-15 11:08:31 +0400 |
commit | 613d8602292165f86ba1969784fea01a06d55900 (patch) | |
tree | cb3c21714cc4ae35a36313a234b3d32ea8bf9838 /tools | |
parent | 038e836e97e70c4ad2b5058b07fc7207f50b59dd (diff) | |
download | linux-613d8602292165f86ba1969784fea01a06d55900.tar.xz |
perf record: Fix fast task-exit race
Recording with -a (or with -p) can race with tasks going away:
couldn't open /proc/8440/maps
Causing an early exit() and no recording done.
Do not abort the recording session - instead just skip that task.
Also, only print the warnings under -v.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index a177a591b52c..e1dfef24887f 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -202,8 +202,12 @@ static void pid_synthesize_comm_event(pid_t pid, int full) fd = open(filename, O_RDONLY); if (fd < 0) { - fprintf(stderr, "couldn't open %s\n", filename); - exit(EXIT_FAILURE); + /* + * We raced with a task exiting - just return: + */ + if (verbose) + fprintf(stderr, "couldn't open %s\n", filename); + return; } if (read(fd, bf, sizeof(bf)) < 0) { fprintf(stderr, "couldn't read %s\n", filename); @@ -273,8 +277,12 @@ static void pid_synthesize_mmap_samples(pid_t pid) fp = fopen(filename, "r"); if (fp == NULL) { - fprintf(stderr, "couldn't open %s\n", filename); - exit(EXIT_FAILURE); + /* + * We raced with a task exiting - just return: + */ + if (verbose) + fprintf(stderr, "couldn't open %s\n", filename); + return; } while (1) { char bf[BUFSIZ], *pbf = bf; |