mm, memcg: throttle allocators based on ancestral memory.high

Prior to this commit, we only directly check the affected cgroup's
memory.high against its usage.  However, it's possible that we are being
reclaimed as a result of hitting an ancestor memory.high and should be
penalised based on that, instead.

This patch changes memory.high overage throttling to use the largest
overage in its ancestors when considering how many penalty jiffies to
charge.  This makes sure that we penalise poorly behaving cgroups in the
same way regardless of at what level of the hierarchy memory.high was

Fixes: 0e4b01df8659 ("mm, memcg: throttle allocators when failing reclaim over memory.high")
Reported-by: Johannes Weiner <>
Signed-off-by: Chris Down <>
Signed-off-by: Andrew Morton <>
Acked-by: Johannes Weiner <>
Cc: Tejun Heo <>
Cc: Michal Hocko <>
Cc: Nathan Chancellor <>
Cc: Roman Gushchin <>
Cc: <>	[5.4.x+]
Signed-off-by: Linus Torvalds <>
1 file changed