Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

ZhenguoYao and committed by
Andrew Morton
41f88ddf 0ca863b7

+4 -4
+4 -4
kernel/watchdog.c
··· 455 455 { 456 456 int i, group; 457 457 u8 tail = __this_cpu_read(cpustat_tail); 458 - u64 sample_period_second = sample_period; 458 + u64 sample_period_msecond = sample_period; 459 459 460 - do_div(sample_period_second, NSEC_PER_SEC); 460 + do_div(sample_period_msecond, NSEC_PER_MSEC); 461 461 462 462 /* 463 463 * Outputting the "watchdog" prefix on every line is redundant and not 464 464 * concise, and the original alarm information is sufficient for 465 465 * positioning in logs, hence here printk() is used instead of pr_crit(). 466 466 */ 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); 469 469 470 470 for (i = 0; i < NUM_SAMPLE_PERIODS; i++) { 471 471 group = (tail + i) % NUM_SAMPLE_PERIODS;