All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V1] sched: Cancel the slice protection of the idle entity
@ 2025-01-21  3:06 zihan zhou
  2025-02-07  6:44 ` zihan zhou
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: zihan zhou @ 2025-01-21  3:06 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid
  Cc: linux-kernel, zihan zhou

A wakeup non-idle entity should preempt idle entity at any time,
but because of the slice protection of the idle entity, the non-idle
entity has to wait, so just cancel it.

Signed-off-by: zihan zhou <15645113830zzh@gmail.com>
---
 kernel/sched/fair.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3e9ca38512de..7777d110d053 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8851,8 +8851,19 @@ static void check_preempt_wakeup_fair(struct rq *rq, struct task_struct *p, int
 	 * Preempt an idle entity in favor of a non-idle entity (and don't preempt
 	 * in the inverse case).
 	 */
-	if (cse_is_idle && !pse_is_idle)
+	if (cse_is_idle && !pse_is_idle) {
+
+		/*
+		 * When non-idle entity preempt an idle entity,
+		 * don't give idle entity slice protection.
+		 */
+		if (se->vlag == se->deadline)
+			se->vlag = se->deadline + 1;
+
 		goto preempt;
+
+	}
+
 	if (cse_is_idle != pse_is_idle)
 		return;
 
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-08  8:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-21  3:06 [PATCH V1] sched: Cancel the slice protection of the idle entity zihan zhou
2025-02-07  6:44 ` zihan zhou
2025-02-07 12:36 ` Peter Zijlstra
2025-02-08  8:29   ` zihan zhou
2025-02-07 14:50 ` Vincent Guittot
2025-02-08  8:21   ` zihan zhou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.