On Thu, 30 Nov 2023 02:36:43 +0000 SeongJae Park sj@kernel.org wrote:
The core logic uses the below simple feedback loop algorithm to calculate the next aggressiveness level of the scheme from the current aggressiveness level and the current feedback (target_score and current_score). It calculates the compensation for next aggressiveness as a proportion of current aggressiveness and distance to the target score. As a result, it arrives at the near-goal state in a short time using big steps when it's far from the goal, but avoids making unnecessarily radical changes that could turn out to be a bad decision using small steps when its near to the goal.
fwiw, the above is a "proportional controller". MGLRU has, in vmscan.c, a PID controller (proportional, integral, derivative). PID controllers have better accuracy (the integral feedback) and better stability (the derivative feedback).
Generalizing MGLRU's PID controller might be somewhat challenging!