]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sched_ext: Allow dequeue_task_scx to fail
authorYipeng Zou <zouyipeng@huawei.com>
Tue, 20 Aug 2024 02:45:31 +0000 (10:45 +0800)
committerTejun Heo <tj@kernel.org>
Tue, 20 Aug 2024 19:09:01 +0000 (09:09 -1000)
Since dequeue_task() allowed to fail, there is a compile error:

kernel/sched/ext.c:3630:19: error: initialization of ‘bool (*)(struct rq*, struct task_struct *, int)’ {aka ‘_Bool (*)(struct rq *, struct task_struct *, int)’} from incompatible pointer type ‘void (*)(struct rq*, struct task_struct *, int)’
  3630 |  .dequeue_task  = dequeue_task_scx,
       |                   ^~~~~~~~~~~~~~~~

Allow dequeue_task_scx to fail too.

Fixes: 863ccdbb918a ("sched: Allow sched_class::dequeue_task() to fail")
Signed-off-by: Yipeng Zou <zouyipeng@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index 571a7ea0b5cb4f0bd705c16ed5d7f37af0d7d54d..b9bf9ee5ed01ae3e130a522130cb7ae377e00b9d 100644 (file)
@@ -2033,11 +2033,11 @@ static void ops_dequeue(struct task_struct *p, u64 deq_flags)
        }
 }
 
-static void dequeue_task_scx(struct rq *rq, struct task_struct *p, int deq_flags)
+static bool dequeue_task_scx(struct rq *rq, struct task_struct *p, int deq_flags)
 {
        if (!(p->scx.flags & SCX_TASK_QUEUED)) {
                WARN_ON_ONCE(task_runnable(p));
-               return;
+               return true;
        }
 
        ops_dequeue(p, deq_flags);
@@ -2072,6 +2072,7 @@ static void dequeue_task_scx(struct rq *rq, struct task_struct *p, int deq_flags
        sub_nr_running(rq, 1);
 
        dispatch_dequeue(rq, p);
+       return true;
 }
 
 static void yield_task_scx(struct rq *rq)