* A question about sceduling
@ 2005-09-16 7:15 Roy Lee
0 siblings, 0 replies; 2+ messages in thread
From: Roy Lee @ 2005-09-16 7:15 UTC (permalink / raw)
To: linux-kernel
I'm tracing the scheduling code of 2.6.12.
During the process creation, the parent process would let the child process
execute first to avoid the COW overhead.
In wake_up_new_task():
if (!(clone_flags & CLONE_VM)) {
/*
* The VM isn't cloned, so we're in a good position to
* do child-runs-first in anticipation of an exec. This
* usually avoids a lot of COW overhead.
*/
if (unlikely(!current->array))
__activate_task(p, rq);
else {
p->prio = current->prio;
list_add_tail(&p->run_list, ¤t->run_list);
p->array = current->array;
p->array->nr_active++;
rq->nr_running++;
}
set_need_resched();
It sets the flag to notify the kernel to reschedule.
But, the child has the same priority as it's parent and is the at the "tail"
of that priority queue.
What makes the scheduler choose the child to run before the parent?
I couldn't' find the point where the parent goes to sleep voluntarily, or
when did the scheduler put the parent behind the child.
Many Thanks
--
Roy
^ permalink raw reply [flat|nested] 2+ messages in thread* RE: A question about sceduling
@ 2005-09-16 8:54 Zhang, Yanmin
0 siblings, 0 replies; 2+ messages in thread
From: Zhang, Yanmin @ 2005-09-16 8:54 UTC (permalink / raw)
To: Roy Lee, linux-kernel
>>-----Original Message-----
>>From: linux-kernel-owner@vger.kernel.org
>>[mailto:linux-kernel-owner@vger.kernel.org] On Behalf Of Roy Lee
>>Sent: 2005年9月16日 15:16
>>To: linux-kernel@vger.kernel.org
>>Subject: A question about sceduling
>>
>>I'm tracing the scheduling code of 2.6.12.
>>During the process creation, the parent process would let the child process
>>execute first to avoid the COW overhead.
>>
>>In wake_up_new_task():
>>
>> if (!(clone_flags & CLONE_VM)) {
>> /*
>> * The VM isn't cloned, so we're in a good position to
>> * do child-runs-first in anticipation of an exec. This
>> * usually avoids a lot of COW overhead.
>> */
>> if (unlikely(!current->array))
>> __activate_task(p, rq);
>> else {
>> p->prio = current->prio;
>> list_add_tail(&p->run_list, ¤t->run_list);
>> p->array = current->array;
>> p->array->nr_active++;
>> rq->nr_running++;
>> }
>> set_need_resched();
>>
>>It sets the flag to notify the kernel to reschedule.
>>But, the child has the same priority as it's parent and is the at the "tail"
>>of that priority queue.
list_add_tail(&p->run_list, ¤t->run_list) means insert the child into run list before parent (current)., not the tail of that priority queue.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-09-16 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-16 7:15 A question about sceduling Roy Lee
2005-09-16 8:54 Zhang, Yanmin
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®