linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm, memcg: Fix corruption on 64-bit divisor in memory.high throttling
@ 2020-03-12 18:02 Chris Down
  2020-03-12 18:03 ` [PATCH 2/2] mm, memcg: Throttle allocators based on ancestral memory.high Chris Down
  2020-03-16 16:19 ` [PATCH 1/2] mm, memcg: Fix corruption on 64-bit divisor in memory.high throttling Johannes Weiner
  0 siblings, 2 replies; 4+ messages in thread
From: Chris Down @ 2020-03-12 18:02 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Johannes Weiner, Tejun Heo, linux-mm, cgroups, linux-kernel, kernel-team

0e4b01df8659 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: 0e4b01df8659 ("mm, memcg: throttle allocators when failing reclaim over memory.high")
Reported-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Chris Down <chris@chrisdown.name>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-mm@kvack.org
Cc: cgroups@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: kernel-team@fb.com
Cc: stable@vger.kernel.org # 5.4.x
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 63bb6a2aab81..a70206e516fe 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -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,
 			  clamped_high);
 
 	penalty_jiffies = ((u64)overage * overage * HZ)
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-03-16 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12 18:02 [PATCH 1/2] mm, memcg: Fix corruption on 64-bit divisor in memory.high throttling Chris Down
2020-03-12 18:03 ` [PATCH 2/2] mm, memcg: Throttle allocators based on ancestral memory.high Chris Down
2020-03-16 16:21   ` Johannes Weiner
2020-03-16 16:19 ` [PATCH 1/2] mm, memcg: Fix corruption on 64-bit divisor in memory.high throttling Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).