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] [day] [month] [year] [list]
Message-ID: <20230916195612.n7iukjkdjl3dzyxt@airbuntu>
Date:   Sat, 16 Sep 2023 20:56:12 +0100
From:   Qais Yousef <qyousef@...alina.io>
To:     Hongyan Xia <hongyan.xia2@....com>
Cc:     Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Vincent Guittot <vincent.guittot@...aro.org>,
        Dietmar Eggemann <dietmar.eggemann@....com>,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        Lukasz Luba <lukasz.luba@....com>
Subject: Re: [RFC PATCH 2/7] sched/pelt: Add a new function to approximate
 runtime to reach given util

On 09/15/23 10:15, Hongyan Xia wrote:
> On 28/08/2023 00:31, Qais Yousef wrote:
> > It is basically the ramp-up time from 0 to a given value. Will be used
> > later to implement new tunable to control response time  for schedutil.
> > 
> > Signed-off-by: Qais Yousef (Google) <qyousef@...alina.io>
> > ---
> >   kernel/sched/pelt.c  | 21 +++++++++++++++++++++
> >   kernel/sched/sched.h |  1 +
> >   2 files changed, 22 insertions(+)
> > 
> > diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
> > index 50322005a0ae..f673b9ab92dc 100644
> > --- a/kernel/sched/pelt.c
> > +++ b/kernel/sched/pelt.c
> > @@ -487,3 +487,24 @@ unsigned long approximate_util_avg(unsigned long util, u64 delta)
> >   	return sa.util_avg;
> >   }
> > +
> > +/*
> > + * Approximate the required amount of runtime in ms required to reach @util.
> > + */
> > +u64 approximate_runtime(unsigned long util)
> > +{
> > +	struct sched_avg sa = {};
> > +	u64 delta = 1024; // period = 1024 = ~1ms
> > +	u64 runtime = 0;
> > +
> > +	if (unlikely(!util))
> > +		return runtime;
> > +
> > +	while (sa.util_avg < util) {
> > +		accumulate_sum(delta, &sa, 0, 0, 1);
> 
> This looks a bit uncomfortable as the existing comment says that we assume:
> 
> 	if (!load)
> 		runnable = running = 0;
> 
> I haven't looked at the math in detail, but if this is okay, maybe a comment
> saying why this is okay despite the existing comment says otherwise?

Yeah as Dietmar highlighted I should pass 1 for load and it was my bad
misreading the code.

So it should be

	accumulate_sum(delta, &sa, 1, 0, 1);

If that's what you meant, yes.


Thanks!

--
Qais Yousef

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ