lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 26 Mar 2024 09:26:25 +0100
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Shrikanth Hegde <sshegde@...ux.ibm.com>, peterz@...radead.org, yu.c.chen@...el.com, 
	dietmar.eggemann@....com, linux-kernel@...r.kernel.org, nysal@...ux.ibm.com, 
	aboorvad@...ux.ibm.com, srikar@...ux.ibm.com, vschneid@...hat.com, 
	pierre.gondois@....com, qyousef@...alina.io
Subject: Re: [PATCH v6 3/3] sched/fair: Combine EAS check with overutilized access

On Tue, 26 Mar 2024 at 08:58, Ingo Molnar <mingo@...nel.org> wrote:
>
>
> * Shrikanth Hegde <sshegde@...ux.ibm.com> wrote:
>
> >  /*
> > - * Ensure that caller can do EAS. overutilized value
> > - * make sense only if EAS is enabled
> > + * overutilized value make sense only if EAS is enabled
> >   */
> > -static inline int is_rd_overutilized(struct root_domain *rd)
> > +static inline int is_rd_not_overutilized(struct root_domain *rd)
> >  {
> > -     return READ_ONCE(rd->overutilized);
> > +     return sched_energy_enabled() && !READ_ONCE(rd->overutilized);
> >  }
>
> While adding the sched_energy_enabled() condition looks OK, the _not prefix
> This is silly: putting logical operators into functions names is far less
> readable than a !fn()...
>
> > -     if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu))
> > +     if (is_rd_not_overutilized(rq->rd) && cpu_overutilized(rq->cpu))
>
> Especially since we already have cpu_overutilized(). It's far more coherent
> to have the same basic attribute functions and put any negation into
> *actual* logical operators.

I was concerned by the || in this case that could defeat the purpose
of sched_energy_enabled() but it will return early anyway

return !sched_energy_enabled() || READ_ONCE(rd->overutilized);

>
> Thanks,
>
>         Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ