From: Hillf Danton <dhillf@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: [RFC] sched: check RT runqueue overloaded in tick timer
Date: Thu, 30 Jun 2011 20:47:03 +0800 [thread overview]
Message-ID: <BANLkTikH9cdO+bwNN4kGgisP6RCy2Xo-3g@mail.gmail.com> (raw)
Hi Steven
When tick timer runs, runqueue overload is checked. If overloaded and other
CPUs available at the moment, reschedule is fired to allow push logic to move
the pushable tasks somewhere else.
Thanks
Hillf
---
kernel/sched_rt.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/kernel/sched_rt.c b/kernel/sched_rt.c
index b03cd89..afd29a3 100644
--- a/kernel/sched_rt.c
+++ b/kernel/sched_rt.c
@@ -1767,10 +1767,10 @@ static void task_tick_rt(struct rq *rq, struct
task_struct *p, int queued)
* FIFO tasks have no timeslices.
*/
if (p->policy != SCHED_RR)
- return;
+ goto check_overload;
if (--p->rt.time_slice)
- return;
+ goto check_overload;
p->rt.time_slice = DEF_TIMESLICE;
@@ -1782,6 +1782,23 @@ static void task_tick_rt(struct rq *rq, struct
task_struct *p, int queued)
requeue_task_rt(rq, p, 0);
set_tsk_need_resched(p);
}
+
+check_overload:
+#ifdef CONFIG_SMP
+ if (!test_tsk_need_resched(p)) {
+ struct task_struct *t = pick_next_pushable_task(rq);
+ /*
+ * If @rq overloaded and other CPUs available, reschedule
+ * @p to allow the push logic to move the pushable tasks
+ * somewhere else.
+ *
+ * It is a pseudo schedule, since @p, without accident, will
+ * be picked again. If not, fine:)
+ */
+ if (t && cpupri_find(&rq->rd->cpupri, t, NULL))
+ set_tsk_need_resched(p);
+ }
+#endif
}
static void set_curr_task_rt(struct rq *rq)
next reply other threads:[~2011-06-30 12:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-30 12:47 Hillf Danton [this message]
2011-06-30 12:55 ` Steven Rostedt
2011-06-30 13:13 ` 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=BANLkTikH9cdO+bwNN4kGgisP6RCy2Xo-3g@mail.gmail.com \
--to=dhillf@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®