LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [CPU Hotplug PATCH] Restore Idle task's priority during CPU_DEAD notification
[not found] ` <1085537205.2639.61.camel@bach>
@ 2004-05-26 6:16 ` Srivatsa Vaddagiri
2004-05-26 11:27 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Srivatsa Vaddagiri @ 2004-05-26 6:16 UTC (permalink / raw)
To: torvalds; +Cc: Ashok Raj, nickpiggin, Ingo Molnar, Andrew Morton, linux-kernel
Linus,
Patch below (against 2.6.7-rc1) fixes a CPU Hotplug problem wherein
idle task's "->prio" value is not restored to MAX_PRIO during CPU_DEAD
handling. Without this patch, once a CPU is offlined and then later onlined, it
becomes "more or less" useless (does not run any task other than its idle task!)
Please apply.
---
linux-2.6.7-rc1-vatsa/kernel/sched.c | 1 +
1 files changed, 1 insertion(+)
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-25 17:04:34.000000000 +0530
@@ -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);
_
On Wed, May 26, 2004 at 12:06:46PM +1000, Rusty Russell wrote:
> On Wed, 2004-05-26 at 02:35, Raj, Ashok wrote:
> > Thanks Vatsa...
> >
> > It seems to work right now....
>
> It seems obviously correct and harmless to me. As it also fixes a
> problem, I'd say this should go to Linus & Andrew ASAP.
>
> Thanks!
> Rusty.
> --
> Anyone who quotes me in their signature is an idiot -- Rusty Russell
>
--
Thanks and Regards,
Srivatsa Vaddagiri,
Linux Technology Center,
IBM Software Labs,
Bangalore, INDIA - 560017
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CPU Hotplug PATCH] Restore Idle task's priority during CPU_DEAD notification
2004-05-26 6:16 ` [CPU Hotplug PATCH] Restore Idle task's priority during CPU_DEAD notification Srivatsa Vaddagiri
@ 2004-05-26 11:27 ` Ingo Molnar
2004-05-26 11:51 ` Srivatsa Vaddagiri
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2004-05-26 11:27 UTC (permalink / raw)
To: Srivatsa Vaddagiri
Cc: torvalds, Ashok Raj, nickpiggin, Andrew Morton, linux-kernel
* Srivatsa Vaddagiri <vatsa@in.ibm.com> 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@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- 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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [CPU Hotplug PATCH] Restore Idle task's priority during CPU_DEAD notification
2004-05-26 11:27 ` Ingo Molnar
@ 2004-05-26 11:51 ` Srivatsa Vaddagiri
0 siblings, 0 replies; 3+ messages in thread
From: Srivatsa Vaddagiri @ 2004-05-26 11:51 UTC (permalink / raw)
To: Ingo Molnar; +Cc: torvalds, Ashok Raj, nickpiggin, Andrew Morton, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-05-26 11:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <A28EFEDC5416054BA1026D892753E9AF059A50EC@orsmsx404.amr.corp.intel.com>
[not found] ` <1085537205.2639.61.camel@bach>
2004-05-26 6:16 ` [CPU Hotplug PATCH] Restore Idle task's priority during CPU_DEAD notification Srivatsa Vaddagiri
2004-05-26 11:27 ` Ingo Molnar
2004-05-26 11:51 ` Srivatsa Vaddagiri
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).