kernel/sched/deadline.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Commit 8b5e770ed7c0 ("sched/deadline: Optimize pull_dl_task()")
added a goto label seems would be better written as a while
loop.
So replace the goto with a while loop, to make it easier to read.
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ben Segall <bsegall@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Valentin Schneider <vschneid@redhat.com>
Cc: Wanpeng Li <wanpeng.li@linux.intel.com>
Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: Todd Kjos <tkjos@google.com>
Cc: kernel-team@android.com
Reported-by: Todd Kjos <tkjos@google.com>
Signed-off-by: John Stultz <jstultz@google.com>
---
v2:
* Corrects my misreading of the code (as pointed out by Christophe
JAILLET) as already having a while loop, and switches the if to
a while.
---
kernel/sched/deadline.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index d9d5a702f1a61..b2cc71984176a 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2501,16 +2501,13 @@ static struct task_struct *pick_earliest_pushable_dl_task(struct rq *rq, int cpu
return NULL;
next_node = rb_first_cached(&rq->dl.pushable_dl_tasks_root);
-
-next_node:
- if (next_node) {
+ while (next_node) {
p = __node_2_pdl(next_node);
if (task_is_pushable(rq, p, cpu))
return p;
next_node = rb_next(next_node);
- goto next_node;
}
return NULL;
--
2.47.0.338.g60cca15819-goog
On Thu, Dec 05, 2024 at 03:59:35PM -0800, John Stultz wrote:
> Commit 8b5e770ed7c0 ("sched/deadline: Optimize pull_dl_task()")
> added a goto label seems would be better written as a while
> loop.
>
> So replace the goto with a while loop, to make it easier to read.
>
Thanks!
Hi John,
On 05/12/24 15:59, John Stultz wrote:
> Commit 8b5e770ed7c0 ("sched/deadline: Optimize pull_dl_task()")
> added a goto label seems would be better written as a while
> loop.
>
> So replace the goto with a while loop, to make it easier to read.
>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Juri Lelli <juri.lelli@redhat.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ben Segall <bsegall@google.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Valentin Schneider <vschneid@redhat.com>
> Cc: Wanpeng Li <wanpeng.li@linux.intel.com>
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Cc: Todd Kjos <tkjos@google.com>
> Cc: kernel-team@android.com
> Reported-by: Todd Kjos <tkjos@google.com>
> Signed-off-by: John Stultz <jstultz@google.com>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Thanks!
Juri
Hello John,
On 12/6/2024 5:29 AM, John Stultz wrote:
> Commit 8b5e770ed7c0 ("sched/deadline: Optimize pull_dl_task()")
> added a goto label seems would be better written as a while
> loop.
>
> So replace the goto with a while loop, to make it easier to read.
>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Juri Lelli <juri.lelli@redhat.com>
> Cc: Vincent Guittot <vincent.guittot@linaro.org>
> Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Ben Segall <bsegall@google.com>
> Cc: Mel Gorman <mgorman@suse.de>
> Cc: Valentin Schneider <vschneid@redhat.com>
> Cc: Wanpeng Li <wanpeng.li@linux.intel.com>
> Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Cc: Todd Kjos <tkjos@google.com>
> Cc: kernel-team@android.com
> Reported-by: Todd Kjos <tkjos@google.com>
> Signed-off-by: John Stultz <jstultz@google.com>
Gave it a spin on my box. Feel free to add:
Reviewed-and-tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
--
Thanks and Regards,
Prateek
> ---
> v2:
> * Corrects my misreading of the code (as pointed out by Christophe
> JAILLET) as already having a while loop, and switches the if to
> a while.
> ---
> kernel/sched/deadline.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index d9d5a702f1a61..b2cc71984176a 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2501,16 +2501,13 @@ static struct task_struct *pick_earliest_pushable_dl_task(struct rq *rq, int cpu
> return NULL;
>
> next_node = rb_first_cached(&rq->dl.pushable_dl_tasks_root);
> -
> -next_node:
> - if (next_node) {
> + while (next_node) {
> p = __node_2_pdl(next_node);
>
> if (task_is_pushable(rq, p, cpu))
> return p;
>
> next_node = rb_next(next_node);
> - goto next_node;
> }
>
> return NULL;
The following commit has been merged into the sched/core branch of tip:
Commit-ID: 7675361ff9a1d9038025c05267600d0c762c0236
Gitweb: https://git.kernel.org/tip/7675361ff9a1d9038025c05267600d0c762c0236
Author: John Stultz <jstultz@google.com>
AuthorDate: Thu, 05 Dec 2024 15:59:35 -08:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 10 Dec 2024 15:07:06 +01:00
sched: deadline: Cleanup goto label in pick_earliest_pushable_dl_task
Commit 8b5e770ed7c0 ("sched/deadline: Optimize pull_dl_task()")
added a goto label seems would be better written as a while
loop.
So replace the goto with a while loop, to make it easier to read.
Reported-by: Todd Kjos <tkjos@google.com>
Signed-off-by: John Stultz <jstultz@google.com>
Reviewed-and-tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Juri Lelli <juri.lelli@redhat.com>
Link: https://lore.kernel.org/r/20241206000009.1226085-1-jstultz@google.com
---
kernel/sched/deadline.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index 33b4646..643d101 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -2516,16 +2516,13 @@ static struct task_struct *pick_earliest_pushable_dl_task(struct rq *rq, int cpu
return NULL;
next_node = rb_first_cached(&rq->dl.pushable_dl_tasks_root);
-
-next_node:
- if (next_node) {
+ while (next_node) {
p = __node_2_pdl(next_node);
if (task_is_pushable(rq, p, cpu))
return p;
next_node = rb_next(next_node);
- goto next_node;
}
return NULL;
© 2016 - 2025 Red Hat, Inc.