perf thread_map: Skip exited threads when scanning /proc
authorIan Rogers <irogers@google.com>
Wed, 21 Feb 2024 03:41:48 +0000 (19:41 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 22 Feb 2024 17:11:03 +0000 (09:11 -0800)
commit510e528786395e419e9a827ee5d42add021111ee
treefc56ace04bc41d3b85ffe7f9f83d918aefe4c5af
parentb6968f9b5035e8e5a74a83209853f274345c74a2
perf thread_map: Skip exited threads when scanning /proc

Scanning /proc is inherently racy. Scanning /proc/pid/task within that
is also racy as the pid can terminate. Rather than failing in
__thread_map__new_all_cpus, skip pids for such failures.

Signed-off-by: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@arm.com>
Cc: Justin Stitt <justinstitt@google.com>
Cc: Bill Wendling <morbo@google.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: llvm@lists.linux.dev
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240221034155.1500118-2-irogers@google.com
tools/perf/util/thread_map.c