mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched_ext: Allow dequeue_task_scx to fail
@ 2024-08-20  2:45 Yipeng Zou
  2024-08-20 19:09 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Yipeng Zou @ 2024-08-20  2:45 UTC (permalink / raw)
  To: tj, void, mingo, peterz, juri.lelli, vincent.guittot,
	linux-kernel, dietmar.eggemann, rostedt, bsegall, mgorman,
	vschneid
  Cc: zouyipeng

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>
---
 kernel/sched/ext.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 571a7ea0b5cb..b9bf9ee5ed01 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -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)
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] sched_ext: Allow dequeue_task_scx to fail
  2024-08-20  2:45 [PATCH] sched_ext: Allow dequeue_task_scx to fail Yipeng Zou
@ 2024-08-20 19:09 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2024-08-20 19:09 UTC (permalink / raw)
  To: Yipeng Zou
  Cc: void, mingo, peterz, juri.lelli, vincent.guittot, linux-kernel,
	dietmar.eggemann, rostedt, bsegall, mgorman, vschneid

On Tue, Aug 20, 2024 at 10:45:31AM +0800, Yipeng Zou wrote:
> 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>

Applied to sched_ext/for-6.12.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-20 19:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20  2:45 [PATCH] sched_ext: Allow dequeue_task_scx to fail Yipeng Zou
2024-08-20 19:09 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®