lkml.org 
[lkml]   [2022]   [Dec]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 1/2] sched/core: Minor optimize ttwu_runnable()
On Thu,  8 Dec 2022 11:20:06 +0800
Chengming Zhou <zhouchengming@bytedance.com> wrote:

One nit.

> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -3718,9 +3718,16 @@ static int ttwu_runnable(struct task_struct *p, int wake_flags)
>
> rq = __task_rq_lock(p, &rf);
> if (task_on_rq_queued(p)) {
> - /* check_preempt_curr() may use rq clock */
> - update_rq_clock(rq);
> - ttwu_do_wakeup(rq, p, wake_flags, &rf);
> + if (!task_on_cpu(rq, p)) {
> + /*
> + * When on_rq && !on_cpu the task is preempted, see if
> + * it should preempt whatever is current there now.

* it should preempt the task that is current now.

Other than that.

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

> + */
> + update_rq_clock(rq);
> + check_preempt_curr(rq, p, wake_flags);
> + }
> + WRITE_ONCE(p->__state, TASK_RUNNING);
> + trace_sched_wakeup(p);
> ret = 1;
> }
> __task_rq_unlock(rq, &rf);

\
 
 \ /
  Last update: 2023-03-26 23:17    [W:0.058 / U:0.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site