public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sched: cleanup adjusting sched_class
@ 2007-09-24 20:51 Hiroshi Shimamoto
  2007-09-24 21:51 ` Dmitry Adamushko
  2007-09-24 22:03 ` Ingo Molnar
  0 siblings, 2 replies; 4+ messages in thread
From: Hiroshi Shimamoto @ 2007-09-24 20:51 UTC (permalink / raw)
  To: Dmitry Adamushko, Ingo Molnar; +Cc: Andrew Morton, Peter Zijlstra, linux-kernel

Hi Ingo and Dmitry,

I made a clean-up patch about fixing invalid sched_class use.

Dmitry, could you please review and sign it?


The adjusting sched_class is a missing part of the already existing
"do not leak PI boosting priority to the child" at the sched_fork().
This patch moves the adjusting sched_class from wake_up_new_task()
to sched_fork().

Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
---

diff --git a/kernel/sched.c b/kernel/sched.c
index 6107a0c..8862761 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1641,6 +1641,8 @@ void sched_fork(struct task_struct *p, int clone_flags)
 	 * Make sure we do not leak PI boosting priority to the child:
 	 */
 	p->prio = current->normal_prio;
+	if (!rt_prio(p->prio))
+		p->sched_class = &fair_sched_class;
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))
@@ -1682,11 +1684,6 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
 
 	p->prio = effective_prio(p);
 
-	if (rt_prio(p->prio))
-		p->sched_class = &rt_sched_class;
-	else
-		p->sched_class = &fair_sched_class;
-
 	if (!p->sched_class->task_new || !sysctl_sched_child_runs_first ||
 			(clone_flags & CLONE_VM) || task_cpu(p) != this_cpu ||
 			!current->se.on_rq) {



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched: cleanup adjusting sched_class
  2007-09-24 20:51 [PATCH] sched: cleanup adjusting sched_class Hiroshi Shimamoto
@ 2007-09-24 21:51 ` Dmitry Adamushko
  2007-09-24 22:00   ` Ingo Molnar
  2007-09-24 22:03 ` Ingo Molnar
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry Adamushko @ 2007-09-24 21:51 UTC (permalink / raw)
  To: Hiroshi Shimamoto
  Cc: Ingo Molnar, Andrew Morton, Peter Zijlstra, linux-kernel

On 24/09/2007, Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
> Hi Ingo and Dmitry,
>
> I made a clean-up patch about fixing invalid sched_class use.

thanks!

>
> Dmitry, could you please review and sign it?
>
>
> The adjusting sched_class is a missing part of the already existing
> "do not leak PI boosting priority to the child" at the sched_fork().
> This patch moves the adjusting sched_class from wake_up_new_task()
> to sched_fork().
>
> Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>


-- 
Best regards,
Dmitry Adamushko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched: cleanup adjusting sched_class
  2007-09-24 21:51 ` Dmitry Adamushko
@ 2007-09-24 22:00   ` Ingo Molnar
  0 siblings, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2007-09-24 22:00 UTC (permalink / raw)
  To: Dmitry Adamushko
  Cc: Hiroshi Shimamoto, Andrew Morton, Peter Zijlstra, linux-kernel


* Dmitry Adamushko <dmitry.adamushko@gmail.com> wrote:

> On 24/09/2007, Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:
> > Hi Ingo and Dmitry,
> >
> > I made a clean-up patch about fixing invalid sched_class use.
> 
> thanks!
> 
> >
> > Dmitry, could you please review and sign it?
> >
> >
> > The adjusting sched_class is a missing part of the already existing
> > "do not leak PI boosting priority to the child" at the sched_fork().
> > This patch moves the adjusting sched_class from wake_up_new_task()
> > to sched_fork().
> >
> > Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
> 
> Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>

thanks - i've picked up Hiroshi's cleanup.

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] sched: cleanup adjusting sched_class
  2007-09-24 20:51 [PATCH] sched: cleanup adjusting sched_class Hiroshi Shimamoto
  2007-09-24 21:51 ` Dmitry Adamushko
@ 2007-09-24 22:03 ` Ingo Molnar
  1 sibling, 0 replies; 4+ messages in thread
From: Ingo Molnar @ 2007-09-24 22:03 UTC (permalink / raw)
  To: Hiroshi Shimamoto
  Cc: Dmitry Adamushko, Andrew Morton, Peter Zijlstra, linux-kernel


* Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com> wrote:

> Hi Ingo and Dmitry,
> 
> I made a clean-up patch about fixing invalid sched_class use.
> 
> Dmitry, could you please review and sign it?
> 
> 
> The adjusting sched_class is a missing part of the already existing 
> "do not leak PI boosting priority to the child" at the sched_fork(). 
> This patch moves the adjusting sched_class from wake_up_new_task() to 
> sched_fork().

thanks. Note that your cleanup also shrinks the code a bit:

   text    data     bss     dec     hex filename
  40111    4018     292   44421    ad85 sched.o.before
  40102    4018     292   44412    ad7c sched.o.after

which never hurts :)

	Ingo

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-24 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-24 20:51 [PATCH] sched: cleanup adjusting sched_class Hiroshi Shimamoto
2007-09-24 21:51 ` Dmitry Adamushko
2007-09-24 22:00   ` Ingo Molnar
2007-09-24 22:03 ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox