]> Git Repo - linux.git/commit
mm: thp: make deferred split shrinker memcg aware
authorYang Shi <[email protected]>
Mon, 23 Sep 2019 22:38:15 +0000 (15:38 -0700)
committerLinus Torvalds <[email protected]>
Tue, 24 Sep 2019 22:54:11 +0000 (15:54 -0700)
commit87eaceb3faa59b9b4d940ec9554ce251325d83fe
treee01af1eb069f448c047ad4151fd35ad211e3aeb9
parent0a432dcbeb32edcd211a5d8f7847d0da7642a8b4
mm: thp: make deferred split shrinker memcg aware

Currently THP deferred split shrinker is not memcg aware, this may cause
premature OOM with some configuration.  For example the below test would
run into premature OOM easily:

$ cgcreate -g memory:thp
$ echo 4G > /sys/fs/cgroup/memory/thp/memory/limit_in_bytes
$ cgexec -g memory:thp transhuge-stress 4000

transhuge-stress comes from kernel selftest.

It is easy to hit OOM, but there are still a lot THP on the deferred split
queue, memcg direct reclaim can't touch them since the deferred split
shrinker is not memcg aware.

Convert deferred split shrinker memcg aware by introducing per memcg
deferred split queue.  The THP should be on either per node or per memcg
deferred split queue if it belongs to a memcg.  When the page is
immigrated to the other memcg, it will be immigrated to the target memcg's
deferred split queue too.

Reuse the second tail page's deferred_list for per memcg list since the
same THP can't be on multiple deferred split queues.

[[email protected]: simplify deferred split queue dereference per Kirill Tkhai]
Link: http://lkml.kernel.org/r/[email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Yang Shi <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Reviewed-by: Kirill Tkhai <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: "Kirill A . Shutemov" <[email protected]>
Cc: Hugh Dickins <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: Vladimir Davydov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
include/linux/huge_mm.h
include/linux/memcontrol.h
include/linux/mm_types.h
mm/huge_memory.c
mm/memcontrol.c
This page took 0.043313 seconds and 4 git commands to generate.