[PATCH] sched: drop all load weight manipulation for RT tasks

From: Linus Walleij
Date: Mon Oct 11 2010 - 10:37:48 EST


Load weights are for the CFS, they do not belong in the RT
task. This makes all RT scheduling classes leave the
CFS weights alone.

This fixes a real bug as well: I noticed the following
phonomena: a process elevated to SCHED_RR forks with
SCHED_RESET_ON_FORK set, and the child is indeed SCHED_OTHER,
and the niceval is indeed reset to 0. However the
weight inserted by set_load_weight() remains at 0. giving the
task insignificat priority.

With this fix, the weight is reset to what the task had before
being elevated to SCHED_RR/SCHED_FIFO.

Cc: Lennart Poettering <lennart@xxxxxxxxxxxxxx>
Cc: stable@xxxxxxxxxx
Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>
---
Note: in 2.6.34 and earlier kernels, the phenomenon is the
inverse: the tasks return from SCHED_RR/SCHED_FIFO with huge
weights. For the stable series the earlier patch inserting
recalculation of load weights at SCHED_RESET_ON_FORK is likely
more desirable.
---
kernel/sched.c | 6 ------
1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/kernel/sched.c b/kernel/sched.c
index a04b8e6..07f39b5 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1855,12 +1855,6 @@ static void dec_nr_running(struct rq *rq)

static void set_load_weight(struct task_struct *p)
{
- if (task_has_rt_policy(p)) {
- p->se.load.weight = 0;
- p->se.load.inv_weight = WMULT_CONST;
- return;
- }
-
/*
* SCHED_IDLE tasks get minimal weight:
*/
--
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/