LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: [RFC][PATCH 6/7] sched: Balance RT tasks when forked as well
Date: Thu, 16 Jun 2011 21:55:22 -0400
Message-ID: <20110617015919.832743148@goodmis.org> (raw)
In-Reply-To: <20110617015516.301117218@goodmis.org>


[-- Attachment #0: 0006-sched-Balance-RT-tasks-when-forked-as-well.patch --]
[-- Type: text/plain, Size: 1852 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

When a new task is woken, the code to balance the RT task is currently
skipped in the select_task_rq() call. But it will be pushed if the rq
is currently overloaded with RT tasks anyway. The issue is that we
already queued the task, and if it does get pushed, it will have to
be dequeued and requeued on the new run queue. The advantage with
pushing it first is that we avoid this requeuing as we are pushing it
off before the task is ever queued.

See commit: 318e0893ce3f524ca045f9fd9dfd567c0a6f9446 for more details.
    (sched: pre-route RT tasks on wakeup)

The return of select_task_rq() when it is not a wake up has also been
changed to return task_cpu() instead of smp_processor_id(). This is more
of a sanity because the current only other user of select_task_rq()
besides wake ups, is an exec, where task_cpu() should also be the same
as smp_processor_id(). But if it is used for other purposes, lets keep
the task on the same CPU. Why would we mant to migrate it to the current
CPU?

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/sched_rt.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index 1546c1c..33636d2 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1005,10 +1005,12 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
 	struct rq *rq;
 	int cpu;
 
-	if (sd_flag != SD_BALANCE_WAKE)
-		return smp_processor_id();
-
 	cpu = task_cpu(p);
+
+	/* For anything but wake ups, just return the task_cpu */
+	if (sd_flag != SD_BALANCE_WAKE || sd_flag != SD_BALANCE_FORK)
+		goto out;
+
 	rq = cpu_rq(cpu);
 
 	rcu_read_lock();
@@ -1047,6 +1049,7 @@ select_task_rq_rt(struct task_struct *p, int sd_flag, int flags)
 	}
 	rcu_read_unlock();
 
+out:
 	return cpu;
 }
 
-- 
1.7.4.4



  parent reply index

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-17  1:55 [RFC][PATCH 0/7] sched: various updates to the scheduler Steven Rostedt
2011-06-17  1:55 ` [RFC][PATCH 1/7] sched: Fix need_resched() when checking peempt Steven Rostedt
2011-06-17  1:55 ` [RFC][PATCH 2/7] sched: Remove noop in next_prio() Steven Rostedt
2011-06-17  1:55 ` [RFC][PATCH 3/7] sched: Remove noop in lowest_flag_domain() Steven Rostedt
2011-06-17  1:55 ` [RFC][PATCH 4/7] sched, rt: Fix rq->rt.pushable_tasks bug in push_rt_task() Steven Rostedt
2011-06-17  2:33   ` Mike Galbraith
2011-06-17  2:41     ` Steven Rostedt
2011-06-17  1:55 ` [RFC][PATCH 5/7] sched: Remove resetting exec_start in put_prev_task_rt() Steven Rostedt
2011-06-17  1:55 ` Steven Rostedt [this message]
2011-07-26 12:25   ` [RFC][PATCH 6/7] sched: Balance RT tasks when forked as well Peter Zijlstra
2011-07-26 12:35     ` Steven Rostedt
2011-07-26 12:36       ` Peter Zijlstra
2011-07-26 12:50         ` Steven Rostedt
2011-08-14 16:05   ` [tip:sched/core] " tip-bot for Steven Rostedt
2011-06-17  1:55 ` [RFC][PATCH 7/7] sched: Use pushable_tasks to determine next highest prio Steven Rostedt
2011-06-17  2:40 ` [RFC][PATCH 0/7] sched: various updates to the scheduler 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=20110617015919.832743148@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.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

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git
	git clone --mirror https://lore.kernel.org/lkml/10 lkml/git/10.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git