]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: Don't trigger ops.quiescent/runnable() on migrations
authorTejun Heo <tj@kernel.org>
Mon, 9 Sep 2024 23:40:44 +0000 (13:40 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 10 Sep 2024 20:45:20 +0000 (10:45 -1000)
A task moving across CPUs should not trigger quiescent/runnable task state
events as the task is staying runnable the whole time and just stopping and
then starting on different CPUs. Suppress quiescent/runnable task state
events if task_on_rq_migrating().

Signed-off-by: Tejun Heo <tj@kernel.org>
Suggested-by: David Vernet <void@manifault.com>
Cc: Daniel Hodges <hodges.daniel.scott@gmail.com>
Cc: Changwoo Min <multics69@gmail.com>
Cc: Andrea Righi <andrea.righi@linux.dev>
Cc: Dan Schatzberg <schatzberg.dan@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index 8e060a6d4945c76e5130a62a462283db6bba6c90..9ee5a9a261cc6b44b6c5400e67616f4850e45cea 100644 (file)
@@ -2066,7 +2066,7 @@ static void enqueue_task_scx(struct rq *rq, struct task_struct *p, int enq_flags
        rq->scx.nr_running++;
        add_nr_running(rq, 1);
 
-       if (SCX_HAS_OP(runnable))
+       if (SCX_HAS_OP(runnable) && !task_on_rq_migrating(p))
                SCX_CALL_OP_TASK(SCX_KF_REST, runnable, p, enq_flags);
 
        if (enq_flags & SCX_ENQ_WAKEUP)
@@ -2150,7 +2150,7 @@ static bool dequeue_task_scx(struct rq *rq, struct task_struct *p, int deq_flags
                SCX_CALL_OP_TASK(SCX_KF_REST, stopping, p, false);
        }
 
-       if (SCX_HAS_OP(quiescent))
+       if (SCX_HAS_OP(quiescent) && !task_on_rq_migrating(p))
                SCX_CALL_OP_TASK(SCX_KF_REST, quiescent, p, deq_flags);
 
        if (deq_flags & SCX_DEQ_SLEEP)