Skip to content

Commit d397a45

Browse files
cdowntorvalds
authored andcommitted
mm, memcg: fix corruption on 64-bit divisor in memory.high throttling
Commit 0e4b01d 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: 0e4b01d ("mm, memcg: throttle allocators when failing reclaim over memory.high") Reported-by: Johannes Weiner <[email protected]> Signed-off-by: Chris Down <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Johannes 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: http://lkml.kernel.org/r/80780887060514967d414b3cd91f9a316a16ab98.1584036142.git.chris@chrisdown.name Signed-off-by: Linus Torvalds <[email protected]>
1 parent d72520a commit d397a45

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memcontrol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,7 @@ void mem_cgroup_handle_over_high(void)
23392339
*/
23402340
clamped_high = max(high, 1UL);
23412341

2342-
overage = div_u64((u64)(usage - high) << MEMCG_DELAY_PRECISION_SHIFT,
2342+
overage = div64_u64((u64)(usage - high) << MEMCG_DELAY_PRECISION_SHIFT,
23432343
clamped_high);
23442344

23452345
penalty_jiffies = ((u64)overage * overage * HZ)

0 commit comments

Comments
 (0)