mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Hillf Danton <dhillf@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Mike Galbraith <efault@gmx.de>,
	Yong Zhang <yong.zhang0@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] sched: update cpupri for runqueue when its priority changes
Date: Fri, 17 Jun 2011 10:56:03 -0400	[thread overview]
Message-ID: <1308322563.9218.184.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <BANLkTik8PpdwGgLOE7rAauXqGYdnT53GpQ@mail.gmail.com>

On Fri, 2011-06-17 at 20:59 +0800, Hillf Danton wrote:
> On Fri, Jun 17, 2011 at 9:50 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > On Sun, 2011-06-05 at 17:54 +0800, Hillf Danton wrote:
> >> When the priority of runqueue changes, lower or higer, the info of cpupri
> >> should be updated, in cases such as pick_next_task_rt() and switched_to_rt().
> >
> > Why?
> >
> > We do the calculation on queuing and dequeuing the task, we only care
> > about the highest priority task that is on the queue, not what is
> > actually running.
> >
> 
> It is to capture the changes in CPU priority caused by re-queued task and
> throttled RQ.

OK, I talked a little with Peter about this. We don't throttle an rq, we
throttle a group. A group consists of tasks, not rqs. When a group is
throttled, we do not migrate tasks, so the cpupri is not a issue here.

For non throttled groups, tasks are enqueued and when they are, the
cpupri is updated. We *only* care about tasks that are enqueued.

Thus, lets look again at your patch:


> diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
> index 08e9374..9508168 100644
> --- a/kernel/sched_rt.c
> +++ b/kernel/sched_rt.c
> @@ -1158,6 +1158,8 @@ static struct task_struct
> *pick_next_task_rt(struct rq *rq)
>          * lock again later if there is no need to push
>          */
>         rq->post_schedule = has_pushable_tasks(rq);
> +
> +       cpupri_set(&rq->rd->cpupri, rq->cpu, p == NULL ? MAX_RT_PRIO : p->prio);

In pick_next_task_rt(), p is the highes prio that is queued. Thus,
cpupri is already set to p->prio. If p is NULL, then there is no rt
tasks queued on this rq, and cpupri is set to MAX_RT_PRIO. Your patch
here does not change anything.

>  #endif
> 
>         return p;
> @@ -1673,6 +1675,8 @@ static void switched_to_rt(struct rq *rq, struct
> task_struct *p)
>  {
>         int check_resched = 1;
> 
> +       if (!p->on_rq)
> +               return;
>         /*
>          * If we are already running, then there's nothing
>          * that needs to be done. But if we are not running
> @@ -1680,7 +1684,7 @@ static void switched_to_rt(struct rq *rq, struct
> task_struct *p)
>          * If that current running task is also an RT task
>          * then see if we can move to another run queue.
>          */
> -       if (p->on_rq && rq->curr != p) {
> +       if (rq->curr != p) {
>  #ifdef CONFIG_SMP
>                 if (rq->rt.overloaded && push_rt_task(rq) &&
>                     /* Don't resched if we changed runqueues */
> @@ -1690,6 +1694,11 @@ static void switched_to_rt(struct rq *rq,
> struct task_struct *p)
>                 if (check_resched && p->prio < rq->curr->prio)
>                         resched_task(rq->curr);
>         }
> +       else {
> +#ifdef CONFIG_SMP
> +               cpupri_set(&rq->rd->cpupri, rq->cpu, p->prio);
> +#endif

switched_to_rt() is called from sched.c's check_class_changed(), which
is always called after enqueuing the task if p->on_rq was set. Thus, if
this is running and is the highest priority task, cpupri would have this
bit set too. Again, your patch does nothing but add more overhead.

-- Steve


> +       }
>  }
> 
>  /*


  parent reply	other threads:[~2011-06-17 14:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-05  9:54 Hillf Danton
2011-06-17  1:50 ` Steven Rostedt
2011-06-17 12:59   ` Hillf Danton
2011-06-17 14:34     ` Steven Rostedt
2011-06-17 14:56     ` Steven Rostedt [this message]
2011-06-18 14:54       ` Hillf Danton
2011-06-18 17:11         ` Steven Rostedt
2011-06-19  8:33           ` Hillf Danton
2011-06-20 13:20             ` 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=1308322563.9218.184.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=dhillf@gmail.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=yong.zhang0@gmail.com \
    /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®