Re: [PATCH 17/24] sched/fair: Implement delayed dequeue

From: Mike Galbraith
Date: Thu Nov 07 2024 - 04:48:23 EST


On Thu, 2024-11-07 at 05:03 +0100, Mike Galbraith wrote:
>
> I built that patch out of curiosity, and yeah, set_next_task_fair()
> finding a cfs_rq->curr ends play time pretty quickly.

The below improved uptime, and trace_printk() says it's doing the
intended, so I suppose I'll add a feature and see what falls out.

---
kernel/sched/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3794,7 +3794,7 @@ static int ttwu_runnable(struct task_str
int queue_flags = DEQUEUE_NOCLOCK;

if (p->se.sched_delayed)
- queue_flags |= DEQUEUE_DELAYED;
+ queue_flags |= (DEQUEUE_DELAYED | DEQUEUE_SLEEP);

/*
* Since we're not current anywhere *AND* hold pi_lock, dequeue
@@ -3802,7 +3802,7 @@ static int ttwu_runnable(struct task_str
* case further along the ttwu() path.
*/
if (rq->nr_running > 1 && p->nr_cpus_allowed > 1) {
- dequeue_task(rq, p, DEQUEUE_SLEEP | queue_flags);
+ dequeue_task(rq, p, queue_flags);
return 0;
}