From: Frederic Weisbecker <fweisbec@gmail.com>
To: Kevin Hilman <khilman@linaro.org>
Cc: linaro-kernel@lists.linaro.org, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] sched/nohz: fix overflow error in scheduler_tick_max_deferment()
Date: Wed, 19 Jun 2013 21:06:07 +0200 [thread overview]
Message-ID: <20130619190604.GE21522@somewhere.redhat.com> (raw)
In-Reply-To: <1371599913-1232-2-git-send-email-khilman@linaro.org>
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
>
next prev parent reply other threads:[~2013-06-19 19:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-18 23:58 [PATCH 1/2] sched/nohz: add sysctl control over sched_tick_max_deferment Kevin Hilman
2013-06-18 23:58 ` [PATCH 2/2] sched/nohz: fix overflow error in scheduler_tick_max_deferment() Kevin Hilman
2013-06-19 19:06 ` Frederic Weisbecker [this message]
2013-06-19 18:42 ` [PATCH 1/2] sched/nohz: add sysctl control over sched_tick_max_deferment Frederic Weisbecker
2013-06-19 20:34 ` Kevin Hilman
-- strict thread matches above, loose matches on Subject: below --
2013-09-16 22:43 [PATCH 1/2] sched/nohz: add debugfs " Kevin Hilman
2013-09-16 22:43 ` [PATCH 2/2] sched/nohz: fix overflow error in scheduler_tick_max_deferment() Kevin Hilman
2013-09-16 22:43 ` Kevin Hilman
2013-12-17 21:23 [PATCH 1/2] sched/nohz: add debugfs control over sched_tick_max_deferment Kevin Hilman
2013-12-17 21:23 ` [PATCH 2/2] sched/nohz: fix overflow error in scheduler_tick_max_deferment() Kevin Hilman
2014-01-05 13:06 ` Frederic Weisbecker
2014-01-06 18:27 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130619190604.GE21522@somewhere.redhat.com \
--to=fweisbec@gmail.com \
--cc=khilman@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.