[PATCH 3/3] UBUNTU: [Upstream] sched: Add SCHED_RESET_ON_FORK functionality for nice < 0 tasks

Luke Yelavich themuso at ubuntu.com
Tue Aug 25 02:25:02 UTC 2009


From: Mike Galbraith <efault at gmx.de>

OriginalAuthor: Mike Galbraith <efault at gmx.de>
OriginalLocation: git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip.git
Signed-off-by: Mike Galbraith <efault at gmx.de>
Acked-by: Lennart Poettering <mzxreary at 0pointer.de>
Cc: Peter Zijlstra <peterz at infradead.org>
LKML-Reference: <1245228482.27326.1.camel at marge.simson.net>
Signed-off-by: Ingo Molnar <mingo at elte.hu>
Signed-off-by: Luke Yelavich <luke.yelavich at canonical.com>
---
 kernel/sched.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index 904fe73..cddd1aa 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2651,6 +2651,11 @@ void sched_fork(struct task_struct *p, int clone_flags)
 		if (p->normal_prio < DEFAULT_PRIO)
 			p->prio = DEFAULT_PRIO;
 
+		if (PRIO_TO_NICE(p->static_prio) < 0) {
+			p->static_prio = NICE_TO_PRIO(0);
+			set_load_weight(p);
+		}
+
 		/*
 		 * We don't need the reset flag anymore after the fork. It has
 		 * fulfilled its duty:
-- 
1.6.3.3





More information about the kernel-team mailing list