Skip to content

Commit 41f88dd

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/[email protected] Signed-off-by: ZhenguoYao <[email protected]> Cc: Bitao Hu <[email protected]> Cc: Li Huafei <[email protected]> Cc: Max Kellermann <[email protected]> Cc: Thomas Gleinxer <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 0ca863b commit 41f88dd

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)