From: "Bill Huey (hui)" <bill.huey@gmail.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Steven Rostedt <rostedt@goodmis.org>,
Alessandro Zummo <a.zummo@towertech.it>,
linux-kernel@vger.kernel.org
Cc: luca abeni <luca.abeni@unitn.it>, Juri Lelli <juri.lelli@arm.com>,
Mike Galbraith <umgwanakikbuti@gmail.com>,
Dario Faggioli <raistlin@linux.it>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH RFC v1 10/12] Export SCHED_FIFO/RT requeuing functions
Date: Wed, 13 Apr 2016 23:47:57 -0700 [thread overview]
Message-ID: <1460616479-32258-11-git-send-email-bill.huey@gmail.com> (raw)
In-Reply-To: <1460616479-32258-1-git-send-email-bill.huey@gmail.com>
SCHED_FIFO/RT tail/head runqueue insertion support, initial thread death
support via a hook to the scheduler class. Thread death must include
additional semantics to remove/discharge an admitted task properly.
Signed-off-by: Bill Huey (hui) <bill.huey@gmail.com>
---
kernel/sched/rt.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index c41ea7a..1d77adc 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -8,6 +8,11 @@
#include <linux/slab.h>
#include <linux/irq_work.h>
+#ifdef CONFIG_RTC_CYCLIC
+#include "cyclic.h"
+extern int rt_overrun_task_admitted1(struct rq *rq, struct task_struct *p);
+#endif
+
int sched_rr_timeslice = RR_TIMESLICE;
static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun);
@@ -1321,8 +1326,18 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags)
if (flags & ENQUEUE_WAKEUP)
rt_se->timeout = 0;
+#ifdef CONFIG_RTC_CYCLIC
+ /* if admitted and the current slot then head, otherwise tail */
+ if (rt_overrun_task_admitted1(rq, p)) {
+ if (rt_overrun_task_active(p)) {
+ flags |= ENQUEUE_HEAD;
+ }
+ }
enqueue_rt_entity(rt_se, flags);
+#else
+ enqueue_rt_entity(rt_se, flags & ENQUEUE_HEAD);
+#endif
if (!task_current(rq, p) && p->nr_cpus_allowed > 1)
enqueue_pushable_task(rq, p);
@@ -1367,6 +1382,18 @@ static void requeue_task_rt(struct rq *rq, struct task_struct *p, int head)
}
}
+#ifdef CONFIG_RTC_CYCLIC
+void dequeue_task_rt2(struct rq *rq, struct task_struct *p, int flags)
+{
+ dequeue_task_rt(rq, p, flags);
+}
+
+void requeue_task_rt2(struct rq *rq, struct task_struct *p, int head)
+{
+ requeue_task_rt(rq, p, head);
+}
+#endif
+
static void yield_task_rt(struct rq *rq)
{
requeue_task_rt(rq, rq->curr, 0);
@@ -2177,6 +2204,10 @@ void __init init_sched_rt_class(void)
zalloc_cpumask_var_node(&per_cpu(local_cpu_mask, i),
GFP_KERNEL, cpu_to_node(i));
}
+
+#ifdef CONFIG_RTC_CYCLIC
+ init_rt_overrun();
+#endif
}
#endif /* CONFIG_SMP */
@@ -2322,6 +2353,13 @@ static unsigned int get_rr_interval_rt(struct rq *rq, struct task_struct *task)
return 0;
}
+#ifdef CONFIG_RTC_CYCLIC
+static void task_dead_rt(struct task_struct *p)
+{
+ rt_overrun_entry_delete(p);
+}
+#endif
+
const struct sched_class rt_sched_class = {
.next = &fair_sched_class,
.enqueue_task = enqueue_task_rt,
@@ -2344,6 +2382,9 @@ const struct sched_class rt_sched_class = {
#endif
.set_curr_task = set_curr_task_rt,
+#ifdef CONFIG_RTC_CYCLIC
+ .task_dead = task_dead_rt,
+#endif
.task_tick = task_tick_rt,
.get_rr_interval = get_rr_interval_rt,
--
2.5.0
next prev parent reply other threads:[~2016-04-14 6:50 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 6:47 [PATCH RFC v1 00/12] Cyclic Scheduler Against RTC Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 01/12] Kconfig change Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 02/12] Reroute rtc update irqs to the cyclic scheduler handler Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 03/12] Add cyclic support to rtc-dev.c Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 04/12] Anonymous struct initialization Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 05/12] Task tracking per file descriptor Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 06/12] Add anonymous struct to sched_rt_entity Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 07/12] kernel/userspace additions for addition ioctl() support for rtc Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 08/12] Compilation support Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 09/12] Add priority support for the cyclic scheduler Bill Huey (hui)
2016-04-14 6:47 ` Bill Huey (hui) [this message]
2016-04-14 6:47 ` [PATCH RFC v1 11/12] Cyclic scheduler support Bill Huey (hui)
2016-04-14 6:47 ` [PATCH RFC v1 12/12] Cyclic/rtc documentation Bill Huey (hui)
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=1460616479-32258-11-git-send-email-bill.huey@gmail.com \
--to=bill.huey@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=a.zummo@towertech.it \
--cc=juri.lelli@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.abeni@unitn.it \
--cc=raistlin@linux.it \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=umgwanakikbuti@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;
as well as URLs for NNTP newsgroup(s).