public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: liyu <liyu@ccoss.com.cn>
To: LKML <linux-kernel@vger.kernel.org>
Subject: [Question] Some question about Ingo scheduler.
Date: Sat, 08 Oct 2005 10:45:46 +0800	[thread overview]
Message-ID: <434732DA.20701@ccoss.com.cn> (raw)

Hi, Everyone on lkml

    I am read linux scheduler at home in last vacation.

    After read , I have some question that want to consult:

    1.

    In schedule() function, we can find some code like this:

   
        if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
                switch_count = &prev->nvcsw;
                if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
                                unlikely(signal_pending(prev))))
                        prev->state = TASK_RUNNING;
                else {
                        if (prev->state == TASK_UNINTERRUPTIBLE)
                                rq->nr_uninterruptible++;
                        deactivate_task(prev, rq);
                }
        }

    I think I can understand code in two braces: they want to change
status of task which have signal pending when sleep, or remove task
that is 'deep sleeping' from ready queue.
    but my question is why we do not need such code (in both braces)
when preempt is enable?

   
    2. in scheduler_tick()

    Before split time slice, we should be check some conditions first, these
check code is copied here:

                /*
                 * Prevent a too long timeslice allowing a task to 
monopolize
                 * the CPU. We do this by splitting up the timeslice into
                 * smaller pieces.
                 *
                 * Note: this does not mean the task's timeslices expire or
                 * get lost in any way, they just might be preempted by
                 * another task of equal priority. (one with higher
                 * priority would have preempted this task already.) We
                 * requeue this task to the end of the list on this priority
                 * level, which is in essence a round-robin of tasks with
                 * equal priority.
                 *
                 * This only applies to tasks in the interactive
                 * delta range with at least TIMESLICE_GRANULARITY to 
requeue.
                 */
                if (TASK_INTERACTIVE(p) && !((task_timeslice(p) -
                        p->time_slice) % TIMESLICE_GRANULARITY(p)) &&
                        (p->time_slice >= TIMESLICE_GRANULARITY(p)) &&
                        (p->array == rq->active)) {
                                                                                                   

                        requeue_task(p, rq->active);
                        set_tsk_need_resched(p);
                }

    My  second question is , what's mean of

    (task_timeslice(p) - p->time_slice) % TIMESLICE_GRANULARITY(p)

    ??

   
Thanks in advanced.

sailor



             reply	other threads:[~2005-10-08  2:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-08  2:45 liyu [this message]
2005-10-09 14:16 ` [Question] Some question about Ingo scheduler Steven Rostedt
2005-10-09 16:44   ` Antonio Vargas
2005-10-11  5:19   ` liyu
     [not found]   ` <434B1FBD.3000803@ccoss.com.cn>
2005-10-11  6:20     ` Steven Rostedt
2005-10-11  7:51       ` liyu
2005-10-11  8:05         ` Steven Rostedt
2005-10-11  9:58           ` liyu
2005-10-11 10:53             ` Steven Rostedt

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=434732DA.20701@ccoss.com.cn \
    --to=liyu@ccoss.com.cn \
    --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