Patch "sched_ext: Use SCX_CALL_OP_TASK in task_tick_scx" has been added to the 6.13-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    sched_ext: Use SCX_CALL_OP_TASK in task_tick_scx

to the 6.13-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sched_ext-use-scx_call_op_task-in-task_tick_scx.patch
and it can be found in the queue-6.13 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 2a40cad880113abe94b05905be368484b9a9db2d
Author: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
Date:   Wed Feb 12 21:09:35 2025 +0800

    sched_ext: Use SCX_CALL_OP_TASK in task_tick_scx
    
    [ Upstream commit f5717c93a1b999970f3a64d771a1a9ee68cc37d0 ]
    
    Now when we use scx_bpf_task_cgroup() in ops.tick() to get the cgroup of
    the current task, the following error will occur:
    
    scx_foo[3795244] triggered exit kind 1024:
      runtime error (called on a task not being operated on)
    
    The reason is that we are using SCX_CALL_OP() instead of SCX_CALL_OP_TASK()
    when calling ops.tick(), which triggers the error during the subsequent
    scx_kf_allowed_on_arg_tasks() check.
    
    SCX_CALL_OP_TASK() was first introduced in commit 36454023f50b ("sched_ext:
    Track tasks that are subjects of the in-flight SCX operation") to ensure
    task's rq lock is held when accessing task's sched_group. Since ops.tick()
    is marked as SCX_KF_TERMINAL and task_tick_scx() is protected by the rq
    lock, we can use SCX_CALL_OP_TASK() to avoid the above issue. Similarly,
    the same changes should be made for ops.disable() and ops.exit_task(), as
    they are also protected by task_rq_lock() and it's safe to access the
    task's task_group.
    
    Fixes: 36454023f50b ("sched_ext: Track tasks that are subjects of the in-flight SCX operation")
    Signed-off-by: Chuyi Zhou <zhouchuyi@xxxxxxxxxxxxx>
    Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 37dc02b89cb5b..f48a8bf7a71c6 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -3855,7 +3855,7 @@ static void task_tick_scx(struct rq *rq, struct task_struct *curr, int queued)
 		curr->scx.slice = 0;
 		touch_core_sched(rq, curr);
 	} else if (SCX_HAS_OP(tick)) {
-		SCX_CALL_OP(SCX_KF_REST, tick, curr);
+		SCX_CALL_OP_TASK(SCX_KF_REST, tick, curr);
 	}
 
 	if (!curr->scx.slice)
@@ -4002,7 +4002,7 @@ static void scx_ops_disable_task(struct task_struct *p)
 	WARN_ON_ONCE(scx_get_task_state(p) != SCX_TASK_ENABLED);
 
 	if (SCX_HAS_OP(disable))
-		SCX_CALL_OP(SCX_KF_REST, disable, p);
+		SCX_CALL_OP_TASK(SCX_KF_REST, disable, p);
 	scx_set_task_state(p, SCX_TASK_READY);
 }
 
@@ -4031,7 +4031,7 @@ static void scx_ops_exit_task(struct task_struct *p)
 	}
 
 	if (SCX_HAS_OP(exit_task))
-		SCX_CALL_OP(SCX_KF_REST, exit_task, p, &args);
+		SCX_CALL_OP_TASK(SCX_KF_REST, exit_task, p, &args);
 	scx_set_task_state(p, SCX_TASK_NONE);
 }
 




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux