[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200917101624.708629719@linutronix.de>
Date: Thu, 17 Sep 2020 11:42:10 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Sebastian Siewior <bigeasy@...utronix.de>,
Qais Yousef <qais.yousef@....com>,
Scott Wood <swood@...hat.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Valentin Schneider <valentin.schneider@....com>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Vincent Donnefort <vincent.donnefort@....com>
Subject: [patch 08/10] sched: Add update_migratory() callback to scheduler classes
Provide a mechanism to update the number or migratory tasks in the RT and
deadline scheduler classes.
This will be used by the upcoming migrate_disable/enable() functionality on
RT kernels.
Originally-by: Daniel Bristot de Oliveira <bristot@...hat.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
---
kernel/sched/deadline.c | 10 ++++++++++
kernel/sched/rt.c | 10 ++++++++++
kernel/sched/sched.h | 4 ++++
3 files changed, 24 insertions(+)
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -479,6 +479,13 @@ static void dec_dl_migration(struct sche
update_dl_migration(dl_rq);
}
+#ifdef CONFIG_PREEMPT_RT
+static void update_migratory_dl(struct task_struct *p, long delta)
+{
+ task_rq(p)->dl.dl_nr_migratory += delta;
+}
+#endif
+
/*
* The list of pushable -deadline task is not a plist, like in
* sched_rt.c, it is an rb-tree with tasks ordered by deadline.
@@ -2499,6 +2506,9 @@ const struct sched_class dl_sched_class
.rq_online = rq_online_dl,
.rq_offline = rq_offline_dl,
.task_woken = task_woken_dl,
+#ifdef CONFIG_PREEMPT_RT
+ .update_migratory = update_migratory_dl,
+#endif
#endif
.task_tick = task_tick_dl,
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -2272,6 +2272,13 @@ static void switched_from_rt(struct rq *
rt_queue_pull_task(rq);
}
+#ifdef CONFIG_PREEMPT_RT
+static void update_migratory_rt(struct task_struct *p, long delta)
+{
+ task_rq(p)->rt.rt_nr_migratory += delta;
+}
+#endif
+
void __init init_sched_rt_class(void)
{
unsigned int i;
@@ -2449,6 +2456,9 @@ const struct sched_class rt_sched_class
.rq_offline = rq_offline_rt,
.task_woken = task_woken_rt,
.switched_from = switched_from_rt,
+#ifdef CONFIG_PREEMPT_RT
+ .update_migratory = update_migratory_rt,
+#endif
#endif
.task_tick = task_tick_rt,
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1808,6 +1808,10 @@ struct sched_class {
void (*set_cpus_allowed)(struct task_struct *p,
const struct cpumask *newmask);
+#ifdef CONFIG_PREEMPT_RT
+ void (*update_migratory)(struct task_struct *p, long delta);
+#endif
+
void (*rq_online)(struct rq *rq);
void (*rq_offline)(struct rq *rq);
#endif
Powered by blists - more mailing lists