public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Galbraith <efault@gmx.de>
To: Lennart Poettering <mzxreary@0pointer.de>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org
Subject: [patch 1/2] Re: [PATCH] scheduler: introduce SCHED_RESET_ON_FORK scheduling policy flag, fourth try
Date: Wed, 17 Jun 2009 10:46:01 +0200	[thread overview]
Message-ID: <1245228361.18329.6.camel@marge.simson.net> (raw)
In-Reply-To: <20090616164742.GA21385@tango.0pointer.de>

On Tue, 2009-06-16 at 18:47 +0200, Lennart Poettering wrote:
> On Tue, 16.06.09 11:05, Mike Galbraith (efault@gmx.de) wrote:
> 
> > I think it's cleaner to keep reset_on_fork functionality separate.
> > Thoughts on the below?
> 
> Looks good to me!

OK, I'll submit then, splitting cleanup from functionality addition.

commit 58e1710a8a525e0fb1f4c608d5f73377fb56c893
Author: Mike Galbraith <efault@gmx.de>
Date:   Wed Jun 17 10:16:26 2009 +0200

    sched: SCHED_RESET_ON_FORK cleanup.
    
    Make SCHED_RESET_ON_FORK sched_fork() bits a self-contained unlikely code path.
    
    Signed-off-by: Mike Galbraith <efault@gmx.de>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Lennart Poettering <mzxreary@0pointer.de>
    LKML-Reference: <new-submission>
---
 kernel/sched.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 095892c..3c27e44 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2613,28 +2613,30 @@ void sched_fork(struct task_struct *p, int clone_flags)
 	set_task_cpu(p, cpu);
 
 	/*
-	 * Revert to default priority/policy on fork if requested. Make sure we
-	 * do not leak PI boosting priority to the child.
+	 * Make sure we do not leak PI boosting priority to the child.
 	 */
-	if (current->sched_reset_on_fork &&
-			(p->policy == SCHED_FIFO || p->policy == SCHED_RR))
-		p->policy = SCHED_NORMAL;
+	p->prio = current->normal_prio;
 
-	if (current->sched_reset_on_fork &&
-			(current->normal_prio < DEFAULT_PRIO))
-		p->prio = DEFAULT_PRIO;
-	else
-		p->prio = current->normal_prio;
+	/*
+	 * Revert to default priority/policy on fork if requested.
+	 */
+	if (unlikely(p->sched_reset_on_fork)) {
+		if (p->policy == SCHED_FIFO || p->policy == SCHED_RR)
+			p->policy = SCHED_NORMAL;
+
+		if (p->normal_prio < DEFAULT_PRIO)
+			p->prio = DEFAULT_PRIO;
+
+		/*
+		 * We don't need the reset flag anymore after the fork. It has
+		 * fulfilled its duty:
+		 */
+		p->sched_reset_on_fork = 0;
+	}
 
 	if (!rt_prio(p->prio))
 		p->sched_class = &fair_sched_class;
 
-	/*
-	 * We don't need the reset flag anymore after the fork. It has
-	 * fulfilled its duty:
-	 */
-	p->sched_reset_on_fork = 0;
-
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
 	if (likely(sched_info_on()))
 		memset(&p->sched_info, 0, sizeof(p->sched_info));



  reply	other threads:[~2009-06-17  8:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-15 15:27 [PATCH] scheduler: introduce SCHED_RESET_ON_FORK scheduling policy flag, fourth try Lennart Poettering
2009-06-15 15:37 ` [tip:sched/core] sched: Introduce SCHED_RESET_ON_FORK scheduling policy flag tip-bot for Lennart Poettering
2009-06-16  9:05 ` [PATCH] scheduler: introduce SCHED_RESET_ON_FORK scheduling policy flag, fourth try Mike Galbraith
2009-06-16 16:47   ` Lennart Poettering
2009-06-17  8:46     ` Mike Galbraith [this message]
2009-06-17  8:48       ` [patch 2/2] " Mike Galbraith
2009-06-17 16:36         ` [tip:sched/core] sched: Add SCHED_RESET_ON_FORK functionality for nice < 0 tasks tip-bot for Mike Galbraith
2009-06-17 16:36       ` [tip:sched/core] sched: Clean up SCHED_RESET_ON_FORK tip-bot for Mike Galbraith
2009-06-17 10:32   ` [tip:sched/core] sched: Introduce SCHED_RESET_ON_FORK scheduling policy flag, fix tip-bot for Mike Galbraith

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=1245228361.18329.6.camel@marge.simson.net \
    --to=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mzxreary@0pointer.de \
    --cc=peterz@infradead.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