Re: [PATCH proxmox v2 1/6] resource-scheduling: clamp imbalance value to unit interval

Dominik Rusovac
2026-04-30T08:33:20Z

On Thu Apr 30, 2026 at 9:48 AM CEST, Daniel Kral wrote:
> On Wed Apr 29, 2026 at 2:20 PM CEST, Dominik Rusovac wrote:
>> The currently used load imbalance value is given as the so-called
>> coefficient of variation (CV), a value that may exceed 1. As such, the
>> CV value alone lacks meaning. A CV value of 0.0 means no imbalance, but
>> what does a value of, say, 1.7 mean?
>>
>> Relative to the number of nodes in a cluster, it is possible to
>> determine the upper bound of the CV value [0][1]. By dividing the CV
>> value by its upper bound, the load imbalance can be represented as a
>> value that varies between 0 and 1. Expressing the CV as a percentage
>> makes the concept of load imbalance easier to interpret.
>>
>> Re-adjust hardcoded imbalance values within tests accordingly.
>>
>> [0] https://repositorio.ipbeja.pt/server/api/core/bitstreams/8ed9a444-dbe0-402f-9d2f-90c5bf6e418c/content
>> [1] https://stats.stackexchange.com/questions/18621/maximum-value-of-coefficient-of-variation-for-bounded-data-set
>>
>> Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
>> ---
>>
>> Notes:
>> changes since v1:
>> * squash commit that re-adjusts tests into this one
>> * back to multiple `as f64` casts of node_count variable
>> * go from if-else to early-return
>> * make comment above early return clause more explanatory
>> * re-order cv and max_cv bindings
>> * add comment with ref relating to computation of max_cv
>>

[snip]

>> + let cv = load_sd / load_mean;
>> +
>
> small whitespace error, could also be fixed on apply though
>

in fact, the whitespace is intentional here

since you asked to add a ref relating to max_cv, I decided to isolate
the binding with its respective comment, which imo increases readability

can be removed on apply tho, if it's considered disturbing

[snip]