Hello,
I've got a problem about the migration_thread. Migration_thread
is used to migrate a specific task from one cpu to another. I use it
to let one task migrate between cpus.
I am working on Intel Duo Core and with Linux 2.6.21. And my
problem is that the migration thread sometimes takes short time to
finish, but sometimes takes lots of time to finish. Because I can't do
another migration through migration thread before the previous
migration finishes, I can only wait a long time.
My function my_migrate() is called in softirq, just like
load_balance() does.
My pseudocode is like following,
/**********************/
static int xl_migrate(int this_cpu, struct rq* this_rq)
{
int dest_cpu;
static int flag = 0;
struct task_struct* curr;
/* flag = 1 means code is being run, and migration code is protected.*/
if(flag == 1)
return 0;
if( Currently running is a task I want to migrate... ){
flag = 1;
Set dest_cpu...
sched_migrate_task(curr, mycpu);
printk("%s:migrate to cpu %d\n", today, mycpu);
flag = 0;
}
return 0;
}
/**********************/
It seems that the printk is showed long after the thread
migration is done. I don't know why the completion of migration is so
slow. Or any code is wrong? Can anyone help me? Thanks!
Best regards,
Liang