Skip to content

Commit

Permalink
watchdog/hardlockup/perf: Warn if watchdog_ev is leaked
Browse files Browse the repository at this point in the history
When creating a new perf_event for the hardlockup watchdog, it should not
happen that the old perf_event is not released.

Introduce a WARN_ONCE() that should never trigger.

[ mingo: Changed the type of the warning to WARN_ONCE(). ]

Signed-off-by: Li Huafei <lihuafei1@huawei.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: https://lore.kernel.org/r/20241021193004.308303-2-lihuafei1@huawei.com
  • Loading branch information
Li Huafei authored and Ingo Molnar committed Mar 6, 2025
1 parent d6834d9 commit 0576388
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions kernel/watchdog_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int hardlockup_detector_event_create(void)
PTR_ERR(evt));
return PTR_ERR(evt);
}
WARN_ONCE(this_cpu_read(watchdog_ev), "unexpected watchdog_ev leak");
this_cpu_write(watchdog_ev, evt);
return 0;
}
Expand Down

0 comments on commit 0576388

Please sign in to comment.