Re: [CPU Hotplug PATCH] Restore Idle task's priority during CPU_DEAD notification

From: Ingo Molnar
Date: Wed May 26 2004 - 06:31:48 EST



* Srivatsa Vaddagiri <vatsa@xxxxxxxxxx> wrote:

> @@ -3569,6 +3569,7 @@ static int migration_call(struct notifie
> rq = task_rq_lock(rq->idle, &flags);
> deactivate_task(rq->idle, rq);
> __setscheduler(rq->idle, SCHED_NORMAL, MAX_PRIO);
> + rq->idle->prio = MAX_PRIO;
> task_rq_unlock(rq, &flags);
> BUG_ON(rq->nr_running != 0);

Looks good. A small nit: while your patch creates a perfectly correct
idle thread too, i'd prefer the modified variant below. The
__setscheduler() call is (technically) incorrect because in the
SCHED_NORMAL case the prio should be zero. So it's a bit cleaner to set
up the static priority to MAX_PRIO and then revert the policy to
SCHED_NORMAL via __setscheduler(). Ok?

Ingo

From: Srivatsa Vaddagiri <vatsa@xxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -3566,7 +3566,8 @@ static int migration_call(struct notifie
/* Idle task back to normal (off runqueue, low prio) */
rq = task_rq_lock(rq->idle, &flags);
deactivate_task(rq->idle, rq);
- __setscheduler(rq->idle, SCHED_NORMAL, MAX_PRIO);
+ rq->idle->static_prio = MAX_PRIO;
+ __setscheduler(rq->idle, SCHED_NORMAL, 0);
task_rq_unlock(rq, &flags);
BUG_ON(rq->nr_running != 0);

-
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/