task migration problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux