perf sched: Fix thread leaks in 'perf sched timehist'
authorNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 01:49:38 +0000 (18:49 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 3 Jul 2025 18:33:18 +0000 (11:33 -0700)
commite2eb59260c4f6bac403491d0112891766b8650d1
tree2d319e3ca8c24bea5df918c1ffd948a5d0b1f81c
parentdc3a80c98884d86389b3b572c50ccc7f502cd41b
perf sched: Fix thread leaks in 'perf sched timehist'

Add missing thread__put() after machine__findnew_thread() or
timehist_get_thread().  Also idle threads' last_thread should be
refcounted properly.

Fixes: 699b5b920db04a6f ("perf sched timehist: Save callchain when entering idle")
Reviewed-by: Ian Rogers <irogers@google.com>
Tested-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250703014942.1369397-5-namhyung@kernel.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/builtin-sched.c