[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080703223323.u3i8r8wg04ww48c8@webmail1.sjtu.edu.cn>
Date: Thu, 03 Jul 2008 22:33:23 +0800
From: xialiang <xiaiaxaxi@...u.edu.cn>
To: linux-kernel@...r.kernel.org
Subject: Why does migration take quite a long time?
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists