lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 9 Nov 2009 09:28:00 GMT From: tip-bot for Hitoshi Mitake <mitake@....info.waseda.ac.jp> To: linux-tip-commits@...r.kernel.org Cc: linux-kernel@...r.kernel.org, acme@...hat.com, paulus@...ba.org, hpa@...or.com, mingo@...hat.com, a.p.zijlstra@...llo.nl, rusty@...tcorp.com.au, efault@....de, mitake@....info.waseda.ac.jp, jkosina@...e.cz, fweisbec@...il.com, tglx@...utronix.de, mingo@...e.hu Subject: [tip:perf/bench] perf bench: Fix bench/sched-pipe.c to wait for child process Commit-ID: 5ff0cfc67f00fe0feaa1da0b2359232ea4aa0ee7 Gitweb: http://git.kernel.org/tip/5ff0cfc67f00fe0feaa1da0b2359232ea4aa0ee7 Author: Hitoshi Mitake <mitake@....info.waseda.ac.jp> AuthorDate: Mon, 9 Nov 2009 12:31:05 +0900 Committer: Ingo Molnar <mingo@...e.hu> CommitDate: Mon, 9 Nov 2009 08:14:30 +0100 perf bench: Fix bench/sched-pipe.c to wait for child process Ingo reported this small 'perf bench sched pipe' output problem: | $ ./perf bench sched pipe | (executing 1000000 pipe operations between two tasks) | | Total time:4.898 sec | $ 4.898586 usecs/op | 204140 ops/sec | | the shell prompt came back before the usecs/op and ops/sec line | was printed. Process teardown race, lack of wait() or so? This caused by lack of calling waitpid() by parent process, so I added it. Signed-off-by: Hitoshi Mitake <mitake@....info.waseda.ac.jp> Cc: Rusty Russell <rusty@...tcorp.com.au> Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl> Cc: Paul Mackerras <paulus@...ba.org> Cc: Mike Galbraith <efault@....de> Cc: Arnaldo Carvalho de Melo <acme@...hat.com> Cc: Frederic Weisbecker <fweisbec@...il.com> Cc: Jiri Kosina <jkosina@...e.cz> LKML-Reference: <1257737465-7546-1-git-send-email-mitake@....info.waseda.ac.jp> Signed-off-by: Ingo Molnar <mingo@...e.hu> --- tools/perf/bench/sched-pipe.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/perf/bench/sched-pipe.c b/tools/perf/bench/sched-pipe.c index 3214ed2..6a29100 100644 --- a/tools/perf/bench/sched-pipe.c +++ b/tools/perf/bench/sched-pipe.c @@ -26,6 +26,7 @@ #include <errno.h> #include <assert.h> #include <sys/time.h> +#include <sys/types.h> #define LOOPS_DEFAULT 1000000 static int loops = LOOPS_DEFAULT; @@ -58,8 +59,8 @@ int bench_sched_pipe(int argc, const char **argv, * discarding returned value of read(), write() * causes error in building environment for perf */ - int ret; - pid_t pid; + int ret, wait_stat; + pid_t pid, retpid; argc = parse_options(argc, argv, options, bench_sched_pipe_usage, 0); @@ -87,8 +88,11 @@ int bench_sched_pipe(int argc, const char **argv, gettimeofday(&stop, NULL); timersub(&stop, &start, &diff); - if (pid) + if (pid) { + retpid = waitpid(pid, &wait_stat, 0); + assert((retpid == pid) && WIFEXITED(wait_stat)); return 0; + } if (simple) printf("%lu.%03lu\n", -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists