mm/memcontrol.c: fix the margin computation in mem_cgroup_margin()
Subsystems (2)
[email protected]
maintainerPATCH 17/19 mm/memcontrol.c: fix the margin computation in mem_cgroup_margin()
From: Li RongQing <[email protected]>
Subject: mm/memcontrol.c: fix the margin computation in mem_cgroup_margin()
mem_cgroup_margin() might return (memory.limit - memory_count) when the memsw.limit is in excess. This doesn't happen usually because we do not allow excess on hard limits and (memory.limit <= memsw.limit), but __GFP_NOFAIL charges can force the charge and cause the excess when no memory is really swappable (swap is full or no anonymous memory is left).
[[email protected]: rewrote changelog]
Signed-off-by Li RongQing <[email protected]>
Acked-by Vladimir Davydov <[email protected]>
Acked-by Michal Hocko <[email protected]>
Cc Johannes Weiner <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/memcontrol.c | 2 ++ 1 file changed, 2 insertions(+)
mm/memcontrol.c renamed from mm/memcontrol.c~mm-memcontrol-fix-the-margin-computation-in-mem_cgroup_margin +2 -0
@@ -1108,6 +1108,8 @@ static unsigned long mem_cgroup_margin(s limit =READ_ONCE (memcg->memsw.limit);if (count <= limit) margin =min (margin, limit - count); +else + margin =0 ; }return margin;
_