Messages in this thread | | | Date | Wed, 21 Dec 2022 10:52:02 -0500 | From | Steven Rostedt <> | Subject | Re: [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);
| |