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

From: Srivatsa Vaddagiri
Date: Wed May 26 2004 - 06:52:44 EST


On Wed, May 26, 2004 at 01:27:26PM +0200, Ingo Molnar wrote:
> 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?

Fine. Since we will have to setup the static priority everytime CPU_DEAD is
invoked, would it make sense if we setup this static priority (once and for
all) in init_idle instead?

Untested patch below:


---

linux-2.6.7-rc1-vatsa/kernel/sched.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN kernel/sched.c~restore_idle_prio kernel/sched.c
--- linux-2.6.7-rc1/kernel/sched.c~restore_idle_prio 2004-05-25 17:04:19.000000000 +0530
+++ linux-2.6.7-rc1-vatsa/kernel/sched.c 2004-05-26 17:17:44.000000000 +0530
@@ -3246,7 +3246,7 @@ void __devinit init_idle(task_t *idle, i
idle_rq->curr = idle_rq->idle = idle;
deactivate_task(idle, rq);
idle->array = NULL;
- idle->prio = MAX_PRIO;
+ idle->prio = idle->static_prio = MAX_PRIO;
idle->state = TASK_RUNNING;
set_task_cpu(idle, cpu);
double_rq_unlock(idle_rq, rq);
@@ -3568,7 +3568,7 @@ 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);
+ __setscheduler(rq->idle, SCHED_NORMAL, 0);
task_rq_unlock(rq, &flags);
BUG_ON(rq->nr_running != 0);


_



--


Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
-
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/