Skip to content

Commit

Permalink
watchdog: Fix rounding bug in get_sample_period()
Browse files Browse the repository at this point in the history
In get_sample_period(), softlockup_thresh is integer divided by
5 before the multiplication by NSEC_PER_SEC. This results in
softlockup_thresh being rounded down to the nearest integer
multiple of 5.

For example, a softlockup_thresh of 4 rounds down to 0.

Signed-off-by: Mandeep Singh Baines <[email protected]>
Cc: Marcin Slusarz <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
  • Loading branch information
Mandeep Singh Baines authored and Ingo Molnar committed May 23, 2011
1 parent 3ac1bbc commit 824c6b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/watchdog.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static unsigned long get_sample_period(void)
* increment before the hardlockup detector generates
* a warning
*/
return softlockup_thresh / 5 * NSEC_PER_SEC;
return softlockup_thresh * (NSEC_PER_SEC / 5);
}

/* Commands for resetting the watchdog */
Expand Down

0 comments on commit 824c6b7

Please sign in to comment.