lkml.org 
[lkml]   [2018]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/7] sched/core: uclamp: add CPU clamp groups accounting
On Mon, Apr 09, 2018 at 05:56:09PM +0100, Patrick Bellasi wrote:
> +static inline void uclamp_task_update(struct rq *rq, struct task_struct *p)
> +{
> + int cpu = cpu_of(rq);
> + int clamp_id;
> +
> + /* The idle task does not affect CPU's clamps */
> + if (unlikely(p->sched_class == &idle_sched_class))
> + return;
> + /* DEADLINE tasks do not affect CPU's clamps */
> + if (unlikely(p->sched_class == &dl_sched_class))
> + return;
> +
> + for (clamp_id = 0; clamp_id < UCLAMP_CNT; ++clamp_id) {
> + if (uclamp_task_affects(p, clamp_id))
> + uclamp_cpu_put(p, cpu, clamp_id);
> + else
> + uclamp_cpu_get(p, cpu, clamp_id);
> + }
> +}

Is that uclamp_task_affects() thing there to fix up the fact you failed
to propagate the calling context (enqueue/dequeue) ?

I find this code _really_ hard to read...

> @@ -743,6 +929,7 @@ static inline void enqueue_task(struct rq *rq, struct task_struct *p, int flags)
> if (!(flags & ENQUEUE_RESTORE))
> sched_info_queued(rq, p);
>
> + uclamp_task_update(rq, p);
> p->sched_class->enqueue_task(rq, p, flags);
> }
>
> @@ -754,6 +941,7 @@ static inline void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
> if (!(flags & DEQUEUE_SAVE))
> sched_info_dequeued(rq, p);
>
> + uclamp_task_update(rq, p);
> p->sched_class->dequeue_task(rq, p, flags);
> }
>

\
 
 \ /
  Last update: 2018-04-13 10:44    [W:0.172 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site