Re: [PATCH] sched: Remove unneeded function type cast in do_balance_callbacks()

From: Peter Zijlstra

Date: Wed Aug 19 2026 - 04:08:07 EST


On Wed, Aug 19, 2026 at 11:01:58AM +0300, Vladimir Zapolskiy wrote:
> It's a trivial and non-functional change, the removed explicit function
> type cast does not convert the function type of struct balance_callback
> member (*func), and the cast can be removed.

Right you are; I suspect this was once a struct callback_head. Ah yes,
see commit: 8e5bad7dccec ("sched: Introduce struct balance_callback to
avoid CFI mismatches").


> Signed-off-by: Vladimir Zapolskiy <vz@xxxxxxxxxx>
> ---
> kernel/sched/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index f5f7ff8c680a..63956d8c3db6 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5126,7 +5126,7 @@ static void do_balance_callbacks(struct rq *rq, struct balance_callback *head)
> lockdep_assert_rq_held(rq);
>
> while (head) {
> - func = (void (*)(struct rq *))head->func;
> + func = head->func;
> next = head->next;
> head->next = NULL;
> head = next;
> --
> 2.51.0
>