Re: [RFC PATCH v3 09/14] mm/memcontrol: Make memory.high tier-aware

From: Song Hu

Date: Mon Aug 17 2026 - 21:22:12 EST


(pre-existing, not from this series - mentioning it here because
it reworks memory.high behaviour)

The penalty computation in calculate_high_delay() can overflow:

penalty_jiffies = max_overage * max_overage * HZ;

max_overage is a fixed-point relative overage:
calculate_overage() returns (usage - high) << 20 / high, so the
square times HZ wraps once (usage - high) / high reaches
4096 / sqrt(HZ). That is roughly 130x at HZ=1000 and 259x at
HZ=250 - reachable when memory.high is tightened far below the
current usage of a large working set.

Most wrapped values are still caught by the 2s clamp in
mem_cgroup_handle_over_high(), but residues below the clamp pass
through, and some of them produce far less throttling than
intended - down to no sleep at all.

check_mul_overflow() with a clamp would saturate the penalty
instead of wrapping it. Could be folded in while memory.high is
being reworked, or a standalone fix.