mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <dhillf@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Yong Zhang <yong.zhang0@gmail.com>,
	Mike Galbraith <efault@gmx.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: [PATCH] sched: remove the next highest_prio in RT scheduling
Date: Sat, 4 Jun 2011 12:44:45 +0800	[thread overview]
Message-ID: <BANLkTikzjVd69XRb6psBm1aYSem126YynA@mail.gmail.com> (raw)
In-Reply-To: <1306852804.11899.19.camel@gandalf.stny.rr.com>

On Tue, May 31, 2011 at 10:40 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> On Sat, 2011-05-28 at 22:25 +0800, Hillf Danton wrote:
>> The next highest_prio element in rt_rq structure, is only used when pulling
>> RT task. As shown by the following snippet (in diff format for clearity),
>>
>> -             if (src_rq->rt.highest_prio.next >=
>> +             if (src_rq->rt.highest_prio.curr >=
>>                   this_rq->rt.highest_prio.curr)
>>                       continue;
>>
>> the "next" could be replaced with "curr" in the above comparison, since
>> the next is no less than curr by definition.
>
> But it completely misses the point of what we are doing. We will never
> pull a running task, but we can pull a waiting task. That's the point of
> the "next" field. We want to know if a high priority task is waiting to
> run, and if so, then we will pull it over to this CPU because this CPU
> is about to switch to a task with a lower priority. If a waiting task of
> higher priority than this CPU is on another CPU, we want to pull it
> over.
>
> This patch totally breaks this. We don't care about "curr" we care about
> "next".
>
Hi Steven

Both the next and curr reach same result, or incorrect result, before locking
RQ, as the comment says, it is racy. After locking RQ, priority is checked again
to pull the correct tasks with no running task included. The difference between
the next and curr before locking RQ is the core of the patch that incorrect
result could be achieved with no updating the next field.

thanks
           Hillf

  reply	other threads:[~2011-06-04  4:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-28 14:25 Hillf Danton
2011-05-31 14:40 ` Steven Rostedt
2011-06-04  4:44   ` Hillf Danton [this message]
2011-06-04  5:06     ` Steven Rostedt
2011-06-04  5:11       ` Hillf Danton
2011-06-04 17:34         ` Steven Rostedt
2011-08-14 16:07 ` [tip:sched/core] sched: Use pushable_tasks to determine next highest prio tip-bot for 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=BANLkTikzjVd69XRb6psBm1aYSem126YynA@mail.gmail.com \
    --to=dhillf@gmail.com \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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®