public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>, RT <linux-rt-users@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Gregory Haskins <ghaskins@novell.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [patch 4/8] RT overloaded runqueues accounting
Date: Fri, 19 Oct 2007 14:42:58 -0400	[thread overview]
Message-ID: <20071019184336.669654901@goodmis.org> (raw)
In-Reply-To: 20071019184254.456160632@goodmis.org

[-- Attachment #1: rt-overload.patch --]
[-- Type: text/plain, Size: 1673 bytes --]

This patch adds an RT overload accounting system. When a runqueue has
more than one RT task queued, it is marked as overloaded. That is that it
is a candidate to have RT tasks pulled from it.

Along with the rt_overload counter (number of overloaded runqueues) a
bit mask of overloaded runqueues with RT tasks is set.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/sched_rt.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Index: linux-test.git/kernel/sched_rt.c
===================================================================
--- linux-test.git.orig/kernel/sched_rt.c	2007-10-19 12:34:46.000000000 -0400
+++ linux-test.git/kernel/sched_rt.c	2007-10-19 12:35:58.000000000 -0400
@@ -25,10 +25,23 @@ static void update_curr_rt(struct rq *rq
 	curr->se.exec_start = rq->clock;
 }
 
+#ifdef CONFIG_SMP
+static __cacheline_aligned_in_smp atomic_t rt_overload;
+static cpumask_t rto_cpumask;
+#endif /* CONFIG_SMP*/
+
 static inline void inc_rt_tasks(struct task_struct *p, struct rq *rq)
 {
 	if (rt_task(p))
 		rq->rt_nr_running++;
+#ifdef CONFIG_SMP
+	if (rq->rt_nr_running == 2) {
+		cpu_set(rq->cpu, rto_cpumask);
+		/* Make sure this cpu is visible on rt_overloads */
+		smp_wmb();
+		atomic_inc(&rt_overload);
+	}
+#endif
 }
 
 static inline void dec_rt_tasks(struct task_struct *p, struct rq *rq)
@@ -37,6 +50,12 @@ static inline void dec_rt_tasks(struct t
 		WARN_ON(!rq->rt_nr_running);
 		rq->rt_nr_running--;
 	}
+#ifdef CONFIG_SMP
+	if (rq->rt_nr_running == 1) {
+		atomic_dec(&rt_overload);
+		cpu_clear(rq->cpu, rto_cpumask);
+	}
+#endif
 }
 
 static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)

-- 

  parent reply	other threads:[~2007-10-19 18:45 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-19 18:42 [patch 0/8] New RT Task Balancing Steven Rostedt
2007-10-19 18:42 ` [patch 1/8] Add rt_nr_running accounting Steven Rostedt
2007-10-20 16:45   ` Dmitry Adamushko
2007-10-21  2:13     ` Steven Rostedt
2007-10-19 18:42 ` [patch 2/8] track highest prio queued on runqueue Steven Rostedt
2007-10-19 19:19   ` Steven Rostedt
2007-10-19 19:45   ` Gregory Haskins
2007-10-19 19:57     ` Steven Rostedt
2007-10-20 18:14   ` Dmitry Adamushko
2007-10-21  2:19     ` Steven Rostedt
2007-10-19 18:42 ` [patch 3/8] push RT tasks Steven Rostedt
2007-10-19 18:42 ` Steven Rostedt [this message]
2007-10-19 18:42 ` [patch 5/8] Move prototypes together Steven Rostedt
2007-10-19 18:43 ` [patch 6/8] pull RT tasks Steven Rostedt
2007-10-19 19:24   ` Peter Zijlstra
2007-10-19 19:35     ` Peter Zijlstra
2007-10-19 19:43       ` Steven Rostedt
2007-10-21  9:35   ` Dmitry Adamushko
2007-10-22 13:55     ` Steven Rostedt
2007-10-21 11:59   ` Dmitry Adamushko
2007-10-22 14:05     ` Steven Rostedt
2007-10-22 22:34       ` Dmitry Adamushko
2007-10-23  1:16         ` Steven Rostedt
2007-10-19 18:43 ` [patch 7/8] wake up balance RT Steven Rostedt
2007-10-19 18:43 ` [patch 8/8] disable CFS RT load balancing 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=20071019184336.669654901@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=ghaskins@novell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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