Re: [PATCH] sched/core: Combine separate 'else' and 'if' statements

From: Peter Zijlstra

Date: Mon Jun 08 2026 - 04:19:29 EST


On Mon, Jun 08, 2026 at 03:18:42PM +0800, luoliang@xxxxxxxxxx wrote:
> From: Liang Luo <luoliang@xxxxxxxxxx>
>
> The kernel coding style recommends using 'else if' instead of
> placing 'if' on a separate line after 'else'. This change makes
> the code consistent with the rest of the kernel codebase.

Right, this is because the things used to be inside #ifdef CONFIG_SMP.

I did notice it a few times, but I generally don't bother with
trivialities like this until the code needs touching for other reasons.

But I suppose since you took the effort, I might as well apply this. But
please don't go whitespace fixing the scheduler code.

> Signed-off-by: Liang Luo <luoliang@xxxxxxxxxx>
> ---
> kernel/sched/core.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index da20fb6ea25a..c2bf0fc6ac97 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3716,8 +3716,7 @@ ttwu_do_activate(struct rq *rq, struct task_struct *p, int wake_flags,
> en_flags |= ENQUEUE_RQ_SELECTED;
> if (wake_flags & WF_MIGRATED)
> en_flags |= ENQUEUE_MIGRATED;
> - else
> - if (p->in_iowait) {
> + else if (p->in_iowait) {
> delayacct_blkio_end(p);
> atomic_dec(&task_rq(p)->nr_iowait);
> }
> --
> 2.45.0