[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240422155937.GP30852@noisy.programming.kicks-ass.net>
Date: Mon, 22 Apr 2024 17:59:37 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Xuewen Yan <xuewen.yan94@...il.com>
Cc: Xuewen Yan <xuewen.yan@...soc.com>, mingo@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
yu.c.chen@...el.com, ke.wang@...soc.com, di.shen@...soc.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] sched/eevdf: Prevent vlag from going out of bounds
when reweight_eevdf
On Mon, Apr 22, 2024 at 09:12:12PM +0800, Xuewen Yan wrote:
> By adding a log to observe weight changes in reweight_entity, I found
> that calc_group_shares() often causes new_weight to become very small:
Yes, cgroups do that. But over-all that should not matter no?
Specifically, the whole re-weight thing turns into a series like:
w_0 w_1 w_n-1 w_0
S = --- * --- * ... * ----- = ---
w_1 w_2 w_n w_n
Where S is our ultimate scale factor.
So even if w_m (0 < m < n) is 2, it completely disappears. But yes, it
will create a big term, which is why the initial vlag should be limited.
Notably, nice should not exceed 88761*1024 / 2, but I'm not sure I
remember the limits (if there are any on the cgrou pmuck).
But if roughly 27 bits go to weight, then vlag should not exceed 36,
which should be well within the slice limit iirc.
Also, as said before, due to integer division being truncating, the
actual S should be smaller than the expected S due to error
accumulation.
Anyway, the things to verify are:
- the S series is complete -- missing terms will mess things up right
quick;
- the limits on both the weight and vlag part, their sum exceeding
63bit (plut 1 for sign) will also mess things up.
Powered by blists - more mailing lists