From: Ingo Molnar <mingo@elte.hu>
To: Andrey Gelman <agelman@012.net.il>
Cc: linux-kernel@vger.kernel.org, Andrew Morton <akpm@osdl.org>
Subject: Re: Assumably a BUG in Linux Kernel (scheduler part)
Date: Mon, 12 Jun 2006 09:18:30 +0200 [thread overview]
Message-ID: <20060612071830.GA26475@elte.hu> (raw)
In-Reply-To: <200606091732.02943.agelman@012.net.il>
* Andrey Gelman <agelman@012.net.il> wrote:
> Hello there !
> Assumably, I've discovered a bug in Linux kernel (version 2.6.16), at:
> kernel\sched.c function set_user_nice()
[...]
> //-------------------------------------------------
> /*
> //BUGGED FORMULA : 5 lines
> old_prio = p->prio;
> new_prio = NICE_TO_PRIO(nice);
> delta = new_prio - old_prio;
> p->static_prio = NICE_TO_PRIO(nice);
> p->prio += delta;
> */
> //BUG FIX : 5 lines
> old_prio = p->static_prio;
> new_prio = NICE_TO_PRIO(nice);
> delta = new_prio - old_prio;
> p->static_prio = new_prio;
> p->prio += delta;
> //-------------------------------------------------
you are right, this is a bug in the scheduler - good find.
I did accidentally fix it months ago via one of the PI-scheduling
cleanups, and thus the fix is in the current -mm tree and is scheduled
for 2.6.18 inclusion:
http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.17-rc6/2.6.17-rc6-mm2/broken-out/pi-futex-scheduler-support-for-pi.patch
(see the adding of effective_prio() to set_user_nice(), instead of an
open-coded calculation of the priority)
But i did not realize that this also fixed a bug. The effects of the bug
are minor: a user can renice only 19 times (to go from 0 to +19), so
there's a finite amount of extra timeslices a CPU hog might win due to
this. I'd not include the effective_prio() change in 2.6.17 - it touches
quite some code and we are close to the release of 2.6.17. Nevertheless
kudos for finding and pointing out this bug!
Andrew, please add this to the changelog of
pi-futex-scheduler-support-for-pi.patch:
the effective_prio() cleanups also fix a priority-calculation bug
pointed out by Andrey Gelman, in set_user_nice().
Ingo
prev parent reply other threads:[~2006-06-12 7:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-09 14:32 Assumably a BUG in Linux Kernel (scheduler part) Andrey Gelman
2006-06-12 7:18 ` Ingo Molnar [this message]
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=20060612071830.GA26475@elte.hu \
--to=mingo@elte.hu \
--cc=agelman@012.net.il \
--cc=akpm@osdl.org \
--cc=linux-kernel@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