Message ID | 20171130114723.29210-5-patrick.bellasi@arm.com |
---|---|
State | New |
Headers | show |
Series | [v3,1/6] cpufreq: schedutil: reset sg_cpus's flags at IDLE enter | expand |
On 6 December 2017 at 12:38, Patrick Bellasi <patrick.bellasi@arm.com> wrote: > Hi Vincent, > > On 06-Dec 10:39, Vincent Guittot wrote: >> Hi Patrick, >> >> On 30 November 2017 at 12:47, Patrick Bellasi <patrick.bellasi@arm.com> wrote: > > [...] > >> > static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags) >> > @@ -1564,6 +1564,9 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) >> > >> > p = _pick_next_task_rt(rq); >> > >> > + /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ >> >> p is null when there is no rt task to pick. >> You should test this condition before calling cpufreq_update_util > > Mmm... for what I see, from the above function's implementation, > _pick_next_task_rt() is always returning a valid pointer to an RT > task. > > The above call does a: > > p->se.exec_start = rq_clock_task(rq); > > right before returning, and there is also a BUG_ON(!rt_se) in the > previous RT tasks scanning loop. > > Am I missing something? No you're right the return Null is done earlier if there is no task > >> > + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); >> > + >> > /* The running task is never eligible for pushing */ >> > dequeue_pushable_task(rq, p); > > [...] > >> > @@ -2317,6 +2323,9 @@ static void set_curr_task_rt(struct rq *rq) >> > >> > p->se.exec_start = rq_clock_task(rq); >> > >> > + /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ >> > + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); >> >> Is this change linked to the "- when a task is set to be RT" in the >> commit message ? >> >> I can't see a situation where this is call without the previous one. >> AFAICT, enqueue_task_rt will be called before each call to this >> function > > Yeah, you right, in core.c the pattern seems to always be: > > if (queued) > enqueue_task() > if (running) > set_curr_task() > > I'll remove this chunk from the next version. > >> >> > + >> > /* The running task is never eligible for pushing */ >> > dequeue_pushable_task(rq, p); >> > } > > Thanks for the review! > > -- > #include <best/regards.h> > > Patrick Bellasi
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 4056c19ca3f0..6984032598a6 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -959,9 +959,6 @@ static void update_curr_rt(struct rq *rq) if (unlikely((s64)delta_exec <= 0)) return; - /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ - cpufreq_update_util(rq, SCHED_CPUFREQ_RT); - schedstat_set(curr->se.statistics.exec_max, max(curr->se.statistics.exec_max, delta_exec)); @@ -1327,6 +1324,9 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int flags) if (!task_current(rq, p) && p->nr_cpus_allowed > 1) enqueue_pushable_task(rq, p); + + /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); } static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags) @@ -1564,6 +1564,9 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) p = _pick_next_task_rt(rq); + /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); + /* The running task is never eligible for pushing */ dequeue_pushable_task(rq, p); @@ -2282,6 +2285,9 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p, int queued) { struct sched_rt_entity *rt_se = &p->rt; + /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); + update_curr_rt(rq); watchdog(rq, p); @@ -2317,6 +2323,9 @@ static void set_curr_task_rt(struct rq *rq) p->se.exec_start = rq_clock_task(rq); + /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ + cpufreq_update_util(rq, SCHED_CPUFREQ_RT); + /* The running task is never eligible for pushing */ dequeue_pushable_task(rq, p); }