* task migration problem
@ 2007-04-08 8:02 Tomer Morad
0 siblings, 0 replies; only message in thread
From: Tomer Morad @ 2007-04-08 8:02 UTC (permalink / raw)
To: linux-kernel
Hi,
As part of my PhD research, I'm trying to migrate a task from one CPU to another, but without success. Any help here would be much
appreciated!
The decision whether to migrate a task is taken at scheduler_tick(). I have tried the following approaches:
1. add a request to the migration queue of the current cpu.
2. deactivate the task on this cpu and activating it on the other cpu.
In both cases, the kernel hangs.
This is an example code I used at the end of schedule(), after spin_unlock_irq(rq->lock):
...
finish_task_switch(this_rq(), prev);
} else
spin_unlock_irq(&rq->lock);
//my code starts here. Prev->asymmetric_do_migrate is updated at scheduler_tick
//task_deactivated keeps track whether prev was deactivated in schedule()
//the task should migrate to prev->asymmetric_migrate_to_cpu
if (prev->asymmetric_do_migrate && !task_deactivated && !(prev->flags & PF_DEAD) && (prev != next))
{
struct rq *dest_rq = cpu_rq(prev->asymmetric_migrate_to_cpu);
struct rq *src_rq;
int src_cpu;
local_irq_disable();
src_rq = task_rq(prev);
double_rq_lock(src_rq,dest_rq);
src_cpu = task_cpu(prev);
if (src_cpu!=prev->asymmetric_migrate_to_cpu)
{
set_task_cpu(prev,prev->asymmetric_migrate_to_cpu);
deactivate_task(prev, src_rq);
__activate_task(prev, dest_rq);
}
prev->asymmetric_do_migrate = 0;
double_rq_unlock(src_rq,dest_rq);
local_irq_enable();
}
//my code ends here
prev = current;
if (unlikely(reacquire_kernel_lock(prev) < 0))
goto need_resched_nonpreemptible;
...
Obviously I'm overlooking something trivial, perhaps something with the locks or with the activation mechanism.
Thanks in advance for any help!
Tomer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-04-08 8:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-08 8:02 task migration problem Tomer Morad
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®