Messages in this thread Patch in this message | | | Date | Thu, 1 Jun 2023 05:58:11 +0000 | Subject | [PATCH v4 08/13] sched: Unnest ttwu_runnable in prep for proxy-execution | From | John Stultz <> |
| |
Slightly rework ttwu_runnable to minimize the nesting to help make the proxy-execution changes easier to read.
Should be no logical change here.
Cc: Joel Fernandes <joelaf@google.com> Cc: Qais Yousef <qyousef@google.com> 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: Valentin Schneider <vschneid@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Ben Segall <bsegall@google.com> Cc: Zimuzo Ezeozue <zezeozue@google.com> Cc: Youssef Esmat <youssefesmat@google.com> Cc: Mel Gorman <mgorman@suse.de> Cc: Daniel Bristot de Oliveira <bristot@redhat.com> Cc: Will Deacon <will@kernel.org> Cc: Waiman Long <longman@redhat.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: "Paul E . McKenney" <paulmck@kernel.org> Cc: kernel-team@android.com Signed-off-by: John Stultz <jstultz@google.com> --- kernel/sched/core.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ace75aadb90b..3dce69feb934 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3799,18 +3799,20 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags) int ret = 0; rq = __task_rq_lock(p, &rf); - if (task_on_rq_queued(p)) { - if (!task_on_cpu(rq, p)) { - /* - * When on_rq && !on_cpu the task is preempted, see if - * it should preempt the task that is current now. - */ - update_rq_clock(rq); - check_preempt_curr(rq, p, wake_flags); - } - ttwu_do_wakeup(p); - ret = 1; + if (!task_on_rq_queued(p)) + goto out_unlock; + + if (!task_on_cpu(rq, p)) { + /* + * When on_rq && !on_cpu the task is preempted, see if + * it should preempt the task that is current now. + */ + update_rq_clock(rq); + check_preempt_curr(rq, p, wake_flags); } + ttwu_do_wakeup(p); + ret = 1; +out_unlock: __task_rq_unlock(rq, &rf); return ret; -- 2.41.0.rc0.172.g3f132b7071-goog
| |