Re: [compute-pressure] Add hysteresis to notify pressure observers algorithm (#176)

I think one way to engineer a solution to this could be to model this as a [rate-independent hysteresis]( I.e. we only care about the (past) state and don't care about the time.

Maybe this is easier to explain in pseudocode:

When we're `"serious"`, transition to `"fair"` when `cpu` is less than 85:

if ((state == "serious") && (cpu < 85))
  state = "fair";
When we're `"fair"`, transition to `"serious"` when `cpu` is more than 90:
if ((state == "fair") && (cpu > 90))
  state = "serious";

Please note `cpu` is a placeholder for _some_ input received from the [platform collector]( (likely not CPU utilization, because it has known issues). Also the values 85 and 90 are just placeholders for illustration purposes.

This idea was inspired by a [nonideal relay](


In this visual, `cpu` is the _x_ axis and state is the _y_ axis. `cpu` thresholds α and β map to 85 and 90 respectively in the pseudocode example. The state "serious" maps to  y = 1 and "fair" to y = 0.

With carefully chosen `cpu` metric and thresholds I believe this would avoid flip-flopping between pressure states. We could include some well-known algorithm like this in the spec as an informative note. Implementers are expected to tune their algorithms for various hardware, so keeping this algorithm informative will allow implementers to innovate and improve the quality of implementation over time with consideration for evolving workloads.

GitHub Notification of comment by anssiko
Please view or discuss this issue at using your GitHub account

Sent via github-notify-ml as configured in

Received on Monday, 30 January 2023 14:35:07 UTC