From: "Måns Rullgård" <mru@inprovide.com>
To: Mike Galbraith <efault@gmx.de>
Cc: Bill Davidsen <davidsen@tmr.com>, linux-kernel@vger.kernel.org
Subject: Re: can I bring Linux down by running "renice -20 cpu_intensive_process"?
Date: Fri, 17 Mar 2006 22:22:22 +0000 [thread overview]
Message-ID: <yw1x1wx090f5.fsf@agrajag.inprovide.com> (raw)
In-Reply-To: <1142575550.8868.20.camel@homer> (Mike Galbraith's message of "Fri, 17 Mar 2006 07:05:50 +0100")
Mike Galbraith <efault@gmx.de> writes:
> On Thu, 2006-03-16 at 22:51 +0000, Måns Rullgård wrote:
>> Bill Davidsen <davidsen@tmr.com> writes:
>>
>> > Måns Rullgård wrote:
>> >> Maybe extending sysrq+n to lower the priority of -20 tasks would be a
>> >> good idea.
>> >>
>> > If it runs before the keyboard thread it doesn't matter...
>>
>> Of course not, but that's not generally the case.
>>
>> > But why should this hang anything, when there should be enough i/o
>> > to get out of the user process. There's a good fix for this, don't
>> > give this guy root any more ;-)
>>
>> Ever heard of bugs? Anyone developing a program can make a mistake.
>> If the program runs with realtime scheduling a bug that makes it enter
>> an infinite loop (or do something else that hogs the CPU) can be
>> difficult to find since it rather efficiently locks you out.
>
> Given that someone has already determined that installing a safety valve
> for RT tasks was worth while, and given that there is practically no
> difference between a nice -20 and the lowest RT priority, seems to me
> that extending that safety valve to cover reniced tasks is the
> obviously-correct thing to do. I think you should submit a patch.
Something like this ought to do it (untested):
--- kernel/sched.c.orig 2006-02-09 23:41:57.000000000 +0000
+++ kernel/sched.c 2006-03-17 22:16:46.257298014 +0000
@@ -5681,21 +5681,22 @@
read_lock_irq(&tasklist_lock);
for_each_process (p) {
- if (!rt_task(p))
- continue;
+ if (rt_task(p)) {
+ rq = task_rq_lock(p, &flags);
- rq = task_rq_lock(p, &flags);
-
- array = p->array;
- if (array)
- deactivate_task(p, task_rq(p));
- __setscheduler(p, SCHED_NORMAL, 0);
- if (array) {
- __activate_task(p, task_rq(p));
- resched_task(rq->curr);
+ array = p->array;
+ if (array)
+ deactivate_task(p, task_rq(p));
+ __setscheduler(p, SCHED_NORMAL, 0);
+ if (array) {
+ __activate_task(p, task_rq(p));
+ resched_task(rq->curr);
+ }
+
+ task_rq_unlock(rq, &flags);
+ } else if (TASK_NICE(p) == -20) {
+ set_user_nice(p, 0);
}
-
- task_rq_unlock(rq, &flags);
}
read_unlock_irq(&tasklist_lock);
}
--
Måns Rullgård
mru@inprovide.com
next prev parent reply other threads:[~2006-03-17 22:22 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-10 13:36 Tomasz Chmielewski
2006-03-10 14:44 ` Jan Engelhardt
2006-03-10 14:52 ` Tomasz Chmielewski
2006-03-10 22:01 ` Måns Rullgård
2006-03-10 22:06 ` Jeffrey Hundstad
2006-03-11 10:42 ` Måns Rullgård
2006-03-12 1:41 ` Luke-Jr
2006-03-12 3:46 ` Lee Revell
2006-03-12 3:50 ` Lee Revell
2006-03-12 3:44 ` Lee Revell
2006-03-12 12:00 ` Måns Rullgård
2006-03-16 21:15 ` Bill Davidsen
2006-03-16 22:11 ` Lee Revell
2006-03-16 22:51 ` Måns Rullgård
2006-03-17 6:05 ` Mike Galbraith
2006-03-17 22:22 ` Måns Rullgård [this message]
2006-03-18 12:38 ` Bill Davidsen
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=yw1x1wx090f5.fsf@agrajag.inprovide.com \
--to=mru@inprovide.com \
--cc=davidsen@tmr.com \
--cc=efault@gmx.de \
--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
all inboxes | Powered by JetHome®