lkml.org 
[lkml]   [2019]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 03/15] sched/core: uclamp: Add system default clamps
On Wed, Mar 13, 2019 at 05:09:40PM +0000, Patrick Bellasi wrote:

> Yes, that should be possible... will look into splitting this out in
> v8 to have something like:
>
> ---8<---
> struct uclamp_req {
> /* Clamp value "requested" by a scheduling entity */
> unsigned int value : bits_per(SCHED_CAPACITY_SCALE);
> unsigned int bucket_id : bits_per(UCLAMP_BUCKETS);
> unsigned int active : 1;
> unsigned int user_defined : 1;
> }
>
> struct uclamp_eff {
> unsigned int value : bits_per(SCHED_CAPACITY_SCALE);
> unsigned int bucket_id : bits_per(UCLAMP_BUCKETS);
> }

No, have _1_ type. There is no point what so ever to splitting this.

Also, what's @user_defined about, I don't think I've seen that in the
parent patch.

> struct task_struct {
> // ...
> #ifdef CONFIG_UCLAMP_TASK
> struct uclamp_req uclamp_req[UCLAMP_CNT];
> struct uclamp_eff uclamp_eff[UCLAMP_CNT];

struct uclamp_se uclamp[UCLAMP_CNT];
struct uclamp_se uclamp_req[UCLAMP_CNT];

Where the first is the very same introduced in patch #1, and leaving it
in place avoids having to update the sites already using that (or start
#1 with the _eff name to avoid having to change things around?).

> #endif
> // ...
> }
>
> static inline struct uclamp_eff
> uclamp_eff_get(struct task_struct *p, unsigned int clamp_id)
> {
> struct uclamp_eff uc_eff = p->uclamp_eff[clamp_id];

just this ^, these lines seem like a superfluous duplication:

> uc_eff.bucket_id = p->uclamp_req[clamp_id].bucket_id;
> uc_eff.value = p->uclamp_req[clamp_id].value;


> if (unlikely(uc_eff.clamp_value > uclamp_default[clamp_id].value)) {
> uc_eff.clamp_value = uclamp_default[clamp_id].value;
> uc_eff.bucket_id = uclamp_default[clamp_id].bucket_id;

and:

uc = uclamp_default[clamp_id];

> }
>
> return uc_eff;
> }
>
> static inline void
> uclamp_eff_set(struct task_struct *p, unsigned int clamp_id)
> {
> p->uclamp_eff[clamp_id] = uclamp_eff_get(p, clamp_id);
> }
> ---8<---
>
> Is that what you mean ?

Getting there :-)

\
 
 \ /
  Last update: 2019-03-13 21:10    [W:0.083 / U:8.836 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site