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]
Message-ID: <20210507153827.GA176408@e120877-lin.cambridge.arm.com>
Date:   Fri, 7 May 2021 16:38:28 +0100
From:   Vincent Donnefort <vincent.donnefort@....com>
To:     Dietmar Eggemann <dietmar.eggemann@....com>
Cc:     Xuewen Yan <xuewen.yan94@...il.com>, mingo@...hat.com,
        peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, rostedt@...dmis.org,
        bsegall@...gle.com, mgorman@...e.de, bristot@...hat.com,
        linux-kernel@...r.kernel.org, zhang.lyra@...il.com,
        xuewyan@...mail.com
Subject: Re: [PATCH v2] sched/pelt: Keep UTIL_AVG_UNCHANGED flag in sync when
 calculating last_enqueued_diff

On Fri, May 07, 2021 at 03:36:47PM +0200, Dietmar Eggemann wrote:
> On 07/05/2021 14:35, Vincent Donnefort wrote:
> > On Fri, May 07, 2021 at 07:20:31PM +0800, Xuewen Yan wrote:
> >> From: Xuewen Yan <xuewen.yan@...soc.com>
> >>
> >> Last_enqueued_diff's meaning: "diff = util_est.enqueued(p) - task_util(p)".
> >> When calculating last_enqueued_diff, we add UTIL_AVG_UNCHANGED flag, which
> >> is the LSB, for task_util, but don't add the flag for util_est.enqueued.
> >> However the enqueued's flag had been cleared when the task util changed.
> >> As a result, we add +1 to the diff, this is therefore reducing slightly
> >> UTIL_EST_MARGIN.
> > 
> > Unless I miss something it actually depends on the situation, doesn't it?
> > 
> > if ue.enqueued > task_util(), we remove 1 from the diff => UTIL_EST_MARGIN + 1
> > 
> > if ue.enqueued < task_util(), we add 1 to the diff => UTIL_EST_MARGIN -1
> 
> I get:
> 
> ue.enqueued & UTIL_AVG_UNCHANGED = 0
> 
> last_enqueued_diff = ue.enqueued_old                    -  ue.enqueued_new
> 
> last_enqueued_diff = (ue.enqueued | UTIL_AVG_UNCHANGED) - (task_util(p) | UTIL_AVG_UNCHANGED)
> 
>                                    ^^^^^^^^^^^^^^^^^^^^
>                                    added by patch
> 
> 
> ue.enqueued_old didn't have the flag, otherwise would return earlier
> 
> task_util(p) could have the LSB set but we just set it to make sure it's set
> 
> So last_enqueued_diff is 1 larger.

But we take the abs() of last_enqueued_diff.

If we consider the following examples:

   enqueued_old = 5, enqueued_new = 9
   diff = 5 - (9 + 1) => 5 - 10 => -5

   enqueued_old = 9, enqueued_new = 5
   diff = 9 - (5 + 1) => 9 - 6 => 3

In both cases the delta is supposed to be 4. But in the first case we end-up
with 5. In the second, we end-up with 3. That's why I meant the effect on the
diff depends on who's greater, ue.enqueued or task_util().

> 
> But UTIL_EST_MARGIN stays `SCHED_CAPACITY_SCALE / 100` ?
> 
> Did I miss something here?

But the only purpose of the diff is the comparison against the margin. So
+/-1 in the diff ends-up being the same as doing the opposite for the margin.

All in all, the missing flag ends-up by modifying UTIL_EST_MARGIN by -1 or +1.

-- 
Vincent

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ