mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hillf Danton <dhillf@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Mike Galbraith <efault@gmx.de>,
	Yong Zhang <yong.zhang0@gmail.com>
Subject: [PATCH v0] sched: change how run-queue is selected for RT task
Date: Sat, 21 May 2011 23:28:19 +0800	[thread overview]
Message-ID: <BANLkTimF2d93VVGKHDdFTn=V-1h9nWrs_w@mail.gmail.com> (raw)

When selecting run-queue for a given RT task, we have to take a few
factors, such as task priority and CPU cache affinity, into
consideration. In this work, a simpler method is proposed, which is
focusing on the relation between the current run-queue of the given
task and the given run-queue.

If the current run-queue of task is the given run-queue, the run-queue
of task keeps unchanged, so the CPU cache affinities of both task and
the current task of run-queue remain unchanged. Then there are at
least two tasks competing one CPU, and in the worst case that both
competitors are RT tasks the victim will be selected and processed by
pusher later.

On other hand, if the current run-queue of task is different from the
given run-queue, task is simply delivered to its current run-queue,
since pusher is always willing to do hard works.

In summary, the burden of RT task is always processed first by the
pusher of its current run-queue.

Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/kernel/sched_rt.c	2011-04-27 11:48:50.000000000 +0800
+++ b/kernel/sched_rt.c	2011-05-21 22:19:52.000000000 +0800
@@ -998,14 +998,12 @@ select_task_rq_rt(struct rq *rq, struct
 	 *
 	 * For equal prio tasks, we just let the scheduler sort it out.
 	 */
-	if (unlikely(rt_task(rq->curr)) &&
-	    (rq->curr->rt.nr_cpus_allowed < 2 ||
-	     rq->curr->prio < p->prio) &&
-	    (p->rt.nr_cpus_allowed > 1)) {
-		int cpu = find_lowest_rq(p);

-		return (cpu == -1) ? task_cpu(p) : cpu;
-	}
+	if (task_cpu(p) == rq->cpu)
+		return rq->cpu;
+
+	if (likely(!rt_task(rq->curr)))
+		return rq->cpu;

 	/*
 	 * Otherwise, just let it ride on the affined RQ and the

             reply	other threads:[~2011-05-21 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-21 15:28 Hillf Danton [this message]
2011-05-22 11:53 ` Hillf Danton
2011-05-24 13:31 ` Steven Rostedt
2011-05-24 13:48   ` Hillf Danton

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='BANLkTimF2d93VVGKHDdFTn=V-1h9nWrs_w@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®