]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
perf lock contention: Fix SIGCHLD vs pause() race in __cmd_contention()
authorSwapnil Sapkal <swapnil.sapkal@amd.com>
Wed, 20 May 2026 10:20:17 +0000 (10:20 +0000)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 20 May 2026 20:46:45 +0000 (17:46 -0300)
commit35c9fb22000f1ce10c0f3627d30fa8763e721719
tree427b5d54c2f3fb9708cbf26c5420e1ef129605aa
parent5b8c90e06622308ff4b6c14260baee6fad064289
perf lock contention: Fix SIGCHLD vs pause() race in __cmd_contention()

__cmd_contention() suffers from the same lost-wakeup race as the perf
sched stats paths: SIGCHLD can be consumed by the signal handler
before pause() is entered, hanging the process.

Apply the same fix: replace pause() with a loop checking the 'done'
flag and using waitpid(WNOHANG) for the workload case.

Suggested-by: Namhyung Kim <namhyung@kernel.org>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Swapnil Sapkal <swapnil.sapkal@amd.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <ravi.bangoria@amd.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-lock.c