From: Peter Zijlstra <peterz@infradead.org>
To: Mateusz Guzik <mguzik@redhat.com>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] sched: fix possible divide by zero in avg_atom calculation
Date: Mon, 7 Jul 2014 14:44:09 +0200 [thread overview]
Message-ID: <20140707124409.GO6758@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1402750809-31991-1-git-send-email-mguzik@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
On Sat, Jun 14, 2014 at 03:00:09PM +0200, Mateusz Guzik wrote:
> proc_sched_show_task does:
> if (nr_switches)
> do_div(avg_atom, nr_switches);
>
> nr_switches is unsigned long and do_div truncates it to 32 bits, which
> means it can test non-zero on e.g. x86-64 and be truncated to zero for
> division.
>
> Fix the problem by using div64_ul instead.
>
> As a side effect calculations of avg_atom for big nr_switches are now correct.
>
> Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Thanks.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-07-07 12:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-14 13:00 [PATCH] sched: fix possible divide by zero in avg_atom calculation Mateusz Guzik
2014-07-07 12:44 ` Peter Zijlstra [this message]
2014-07-16 19:22 ` [tip:sched/urgent] sched: Fix possible divide by zero in avg_atom () calculation tip-bot for Mateusz Guzik
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=20140707124409.GO6758@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mguzik@redhat.com \
--cc=mingo@redhat.com \
--cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox