lkml.org 
[lkml]   [2013]   [Jun]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/2] sched/nohz: fix overflow error in scheduler_tick_max_deferment()
On Tue, Jun 18, 2013 at 04:58:29PM -0700, Kevin Hilman wrote:
> The conversion of the max deferment from usecs to nsecs can easily
> overflow on platforms where a long is 32-bits. To fix, cast the usecs
> value to u64 before multiplying by NSECS_PER_USEC.
>
> This was discovered on 32-bit ARM platform when extending the max
> deferment value.
>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Signed-off-by: Kevin Hilman <khilman@linaro.org>

Right, if we make it tunable we need that patch.

Thanks!

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>

> ---
> kernel/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b5d3f99..b506722 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -2765,7 +2765,7 @@ u64 scheduler_tick_max_deferment(void)
> if (time_before_eq(next, now))
> return 0;
>
> - return jiffies_to_usecs(next - now) * NSEC_PER_USEC;
> + return (u64)jiffies_to_usecs(next - now) * NSEC_PER_USEC;
> }
> #endif
>
> --
> 1.8.3
>


\
 
 \ /
  Last update: 2013-06-19 21:41    [W:0.050 / U:1.436 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site