lkml.org 
[lkml]   [2005]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRE: A question about sceduling
    Date
    From
    >>-----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, &current->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, &current->run_list) means insert the child into run list before parent (current)., not the tail of that priority queue.

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

    \
     
     \ /
      Last update: 2005-09-16 10:58    [W:0.023 / U:149.304 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site