public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gene Heskett <gene.heskett@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Chris Wright <chrisw@sous-sol.org>
Subject: Re: [patch] sched: fix SysRq-N (normalize RT tasks)
Date: Thu, 14 Jun 2007 09:48:47 -0400	[thread overview]
Message-ID: <200706140948.48005.gene.heskett@gmail.com> (raw)
In-Reply-To: <20070614094830.GA494@elte.hu>

On Thursday 14 June 2007, Ingo Molnar wrote:
>From: Ingo Molnar <mingo@elte.hu>
>Subject: [patch] sched: fix SysRq-N (normalize RT tasks)
>
>Gene Heskett reported the following problem while testing CFS: SysRq-N
>is not always effective in normalizing tasks back to SCHED_OTHER.
>
>the reason for that turns out to be the following bug:
>normalize_rt_tasks() uses for_each_process() to iterate through all
>tasks in the system. The problem is, this method does not iterate
>through all tasks, it iterates through all thread groups. The proper
>mechanism to enumerate all tasks is to use a do_each_thread() +
>while_each_thread() loop.
>
>obvious bugfix for v2.6.22 inclusion. -stable candidate as well.
>
>Reported-by: Gene Heskett <gene.heskett@gmail.com>
>Signed-off-by: Ingo Molnar <mingo@elte.hu>
>---
> kernel/sched.c |    8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>Index: linux/kernel/sched.c
>===================================================================
>--- linux/kernel/sched.c
>+++ linux/kernel/sched.c
>@@ -7071,12 +7071,13 @@ EXPORT_SYMBOL(__might_sleep);
> void normalize_rt_tasks(void)
> {
> 	struct prio_array *array;
>-	struct task_struct *p;
>+	struct task_struct *g, *p;
> 	unsigned long flags;
> 	struct rq *rq;
>
> 	read_lock_irq(&tasklist_lock);
>-	for_each_process(p) {
>+
>+	do_each_thread(g, p) {
> 		if (!rt_task(p))
> 			continue;
>
>@@ -7094,7 +7095,8 @@ void normalize_rt_tasks(void)
>
> 		__task_rq_unlock(rq);
> 		spin_unlock_irqrestore(&p->pi_lock, flags);
>-	}
>+	} while_each_thread(g, p);
>+
> 	read_unlock_irq(&tasklist_lock);
> }

Ingo:  I appended this patch to the cfs-v16 patch for 2.6.22-rc4, and got this 
while applying it:

patching file kernel/sched.c
Hunk #1 FAILED at 7071.
Hunk #2 FAILED at 7095.
2 out of 2 hunks FAILED -- saving rejects to file kernel/sched.c.rej
done

-- 
Cheers, Gene
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
One man tells a falsehood, a hundred repeat it as true.

  reply	other threads:[~2007-06-14 13:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-14  9:48 [patch] sched: fix SysRq-N (normalize RT tasks) Ingo Molnar
2007-06-14 13:48 ` Gene Heskett [this message]
2007-06-14 13:51   ` Ingo Molnar
2007-06-14 14:37     ` Gene Heskett
2007-06-14 14:12 ` Gene Heskett
2007-06-14 19:09 ` Måns Rullgård

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=200706140948.48005.gene.heskett@gmail.com \
    --to=gene.heskett@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisw@sous-sol.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@linux-foundation.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