From: "Tomer Morad" <tomer.morad@gmail.com>
To: <linux-kernel@vger.kernel.org>
Subject: task migration problem
Date: Sun, 8 Apr 2007 11:02:03 +0300 [thread overview]
Message-ID: <023801c779b4$32f54f00$840a10ac@int.horizonsemi.com> (raw)
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.
reply other threads:[~2007-04-08 8:02 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='023801c779b4$32f54f00$840a10ac@int.horizonsemi.com' \
--to=tomer.morad@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®