[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230908162254.999499-4-bigeasy@linutronix.de>
Date: Fri, 8 Sep 2023 18:22:50 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>, linux-kernel@...r.kernel.org
Cc: bigeasy@...utronix.de, tglx@...utronix.de, boqun.feng@...il.com,
bristot@...hat.com, bsegall@...gle.com, dietmar.eggemann@....com,
jstultz@...gle.com, juri.lelli@...hat.com, longman@...hat.com,
mgorman@...e.de, mingo@...hat.com, rostedt@...dmis.org,
swood@...hat.com, vincent.guittot@...aro.org, vschneid@...hat.com,
will@...nel.org
Subject: [PATCH v3 3/7] sched: Extract __schedule_loop()
From: Thomas Gleixner <tglx@...utronix.de>
There are currently two implementations of this basic __schedule()
loop, and there is soon to be a third.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Signed-off-by: "Peter Zijlstra (Intel)" <peterz@...radead.org>
Link: https://lkml.kernel.org/r/20230427111937.2745231-2-bigeasy@linutronix.de
Link: https://lore.kernel.org/r/20230815111430.288063671@infradead.org
Link: https://lore.kernel.org/r/20230825181033.504534-4-bigeasy@linutronix.de
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
---
kernel/sched/core.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d55564097bd86..1ea7ba53aad24 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -6770,16 +6770,21 @@ static void sched_update_worker(struct task_struct *tsk)
}
}
+static __always_inline void __schedule_loop(unsigned int sched_mode)
+{
+ do {
+ preempt_disable();
+ __schedule(sched_mode);
+ sched_preempt_enable_no_resched();
+ } while (need_resched());
+}
+
asmlinkage __visible void __sched schedule(void)
{
struct task_struct *tsk = current;
sched_submit_work(tsk);
- do {
- preempt_disable();
- __schedule(SM_NONE);
- sched_preempt_enable_no_resched();
- } while (need_resched());
+ __schedule_loop(SM_NONE);
sched_update_worker(tsk);
}
EXPORT_SYMBOL(schedule);
@@ -6843,11 +6848,7 @@ void __sched schedule_preempt_disabled(void)
#ifdef CONFIG_PREEMPT_RT
void __sched notrace schedule_rtlock(void)
{
- do {
- preempt_disable();
- __schedule(SM_RTLOCK_WAIT);
- sched_preempt_enable_no_resched();
- } while (need_resched());
+ __schedule_loop(SM_RTLOCK_WAIT);
}
NOKPROBE_SYMBOL(schedule_rtlock);
#endif
--
2.40.1
Powered by blists - more mailing lists