]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: Update p->scx.disallow warning in scx_init_task()
authorTejun Heo <tj@kernel.org>
Fri, 6 Mar 2026 17:58:02 +0000 (07:58 -1000)
committerTejun Heo <tj@kernel.org>
Fri, 6 Mar 2026 17:58:02 +0000 (07:58 -1000)
- Always trigger the warning if p->scx.disallow is set for fork inits. There
  is no reason to set it during forks.

- Flip the positions of if/else arms to ease adding error conditions.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
kernel/sched/ext.c

index 6f98a979391fa5314f300a05d9dbf003eb0e8d2b..d42a22f5a098e52dd989b5e8b32a439765c46ae9 100644 (file)
@@ -3032,7 +3032,10 @@ static int scx_init_task(struct task_struct *p, struct task_group *tg, bool fork
        scx_set_task_state(p, SCX_TASK_INIT);
 
        if (p->scx.disallow) {
-               if (!fork) {
+               if (unlikely(fork)) {
+                       scx_error(sch, "ops.init_task() set task->scx.disallow for %s[%d] during fork",
+                                 p->comm, p->pid);
+               } else {
                        struct rq *rq;
                        struct rq_flags rf;
 
@@ -3051,9 +3054,6 @@ static int scx_init_task(struct task_struct *p, struct task_group *tg, bool fork
                        }
 
                        task_rq_unlock(rq, p, &rf);
-               } else if (p->policy == SCHED_EXT) {
-                       scx_error(sch, "ops.init_task() set task->scx.disallow for %s[%d] during fork",
-                                 p->comm, p->pid);
                }
        }