sched/core: Combine separate 'else' and 'if' statements
PATCH 1/1 sched/core: Combine separate 'else' and 'if' statements
From: Liang Luo <[email protected]>
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.
--- kernel/sched/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
@@ -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
Peter Zijlstra
maintainerQuoted 5 lines · On Mon, Jun 08, 2026 at 03:18:42PM +0800, [email protected] wrote:
From: Liang Luo <[email protected]>
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.
Quoted 21 lines
Signed-off-by Liang Luo <[email protected]>--- kernel/sched/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)kernel/sched/core.c +1
-3@@ -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
The following commit has been merged into the sched/core branch of tip:
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 76124a050ddbc8b252172205ab04f10a83c03a4d Gitweb: https://git.kernel.org/tip/76124a050ddbc8b252172205ab04f10a83c03a4d Author: Liang Luo <[email protected]> AuthorDate: Mon, 08 Jun 2026 15:18:42 +08:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Tue, 09 Jun 2026 10:28:08 +02:00
sched/core: Combine separate 'else' and 'if' statements
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.
--- kernel/sched/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/sched/core.c +1 -2
@@ -3816,8 +3816,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); }