Commit 11c11643 authored by Chris Down's avatar Chris Down Committed by Greg Kroah-Hartman

mm, memcg: fix corruption on 64-bit divisor in memory.high throttling

commit d397a45f upstream.

Commit 0e4b01df had a bunch of fixups to use the right division
method.  However, it seems that after all that it still wasn't right --
div_u64 takes a 32-bit divisor.

The headroom is still large (2^32 pages), so on mundane systems you
won't hit this, but this should definitely be fixed.

Fixes: 0e4b01df ("mm, memcg: throttle allocators when failing reclaim over memory.high")
Reported-by: default avatarJohannes Weiner <[email protected]>
Signed-off-by: Chris Down's avatarChris Down <[email protected]>
Signed-off-by: default avatarAndrew Morton <[email protected]>
Acked-by: default avatarJohannes Weiner <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Nathan Chancellor <[email protected]>
Cc: <[email protected]>	[5.4.x+]
Link:[email protected]risdown.nameSigned-off-by: default avatarLinus Torvalds <[email protected]>
Signed-off-by: default avatarGreg Kroah-Hartman <[email protected]>
parent 7585887f
......@@ -2339,7 +2339,7 @@ void mem_cgroup_handle_over_high(void)
clamped_high = max(high, 1UL);
overage = div_u64((u64)(usage - high) << MEMCG_DELAY_PRECISION_SHIFT,
overage = div64_u64((u64)(usage - high) << MEMCG_DELAY_PRECISION_SHIFT,
penalty_jiffies = ((u64)overage * overage * HZ)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment