Skip to content

Commit 8f2e23f

Browse files
ZhenguoYao1akpm00
authored andcommitted
watchdog/softlockup: fix wrong output when watchdog_thresh < 3
When watchdog_thresh is below 3, sample_period will be less than 1 second. So the following output will print when softlockup: CPU#3 Utilization every 0s during lockup Fix this by changing time unit from seconds to milliseconds. Link: https://lkml.kernel.org/r/20250812074132.27810-1-yaozhenguo@jd.com Signed-off-by: ZhenguoYao <yaozhenguo1@gmail.com> Cc: Bitao Hu <yaoma@linux.alibaba.com> Cc: Li Huafei <lihuafei1@huawei.com> Cc: Max Kellermann <max.kellermann@ionos.com> Cc: Thomas Gleinxer <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent f149611 commit 8f2e23f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

kernel/watchdog.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,17 +455,17 @@ static void print_cpustat(void)
455455
{
456456
int i, group;
457457
u8 tail = __this_cpu_read(cpustat_tail);
458-
u64 sample_period_second = sample_period;
458+
u64 sample_period_msecond = sample_period;
459459

460-
do_div(sample_period_second, NSEC_PER_SEC);
460+
do_div(sample_period_msecond, NSEC_PER_MSEC);
461461

462462
/*
463463
* Outputting the "watchdog" prefix on every line is redundant and not
464464
* concise, and the original alarm information is sufficient for
465465
* positioning in logs, hence here printk() is used instead of pr_crit().
466466
*/
467-
printk(KERN_CRIT "CPU#%d Utilization every %llus during lockup:\n",
468-
smp_processor_id(), sample_period_second);
467+
printk(KERN_CRIT "CPU#%d Utilization every %llums during lockup:\n",
468+
smp_processor_id(), sample_period_msecond);
469469

470470
for (i = 0; i < NUM_SAMPLE_PERIODS; i++) {
471471
group = (tail + i) % NUM_SAMPLE_PERIODS;

0 commit comments

Comments
 (0)