Establish a new OOM score algorithm, supports the cgroup level OOM protection mechanism. When an global/memcg oom event occurs, we treat all processes in the cgroup as a whole, and OOM killers need to select the process to kill based on the protection quota of the cgroup Changelog: v3: * Add "auto" option for memory.oom.protect. (patch 1) * Fix division errors. (patch 1) * Add observation indicator oom_kill_inherit. (patch 2) v2: * Modify the formula of the process request memcg protection quota. https://lore.kernel.org/linux-mm/20221208034644.3077-1-chengkaitao@xxxxxxxxxxxxxx/ v1: https://lore.kernel.org/linux-mm/20221130070158.44221-1-chengkaitao@xxxxxxxxxxxxxx/ chengkaitao (2): mm: memcontrol: protect the memory in cgroup from being oom killed memcg: add oom_kill_inherit event indicator Documentation/admin-guide/cgroup-v2.rst | 29 ++++- fs/proc/base.c | 17 ++- include/linux/memcontrol.h | 46 +++++++- include/linux/oom.h | 3 +- include/linux/page_counter.h | 6 + mm/memcontrol.c | 199 ++++++++++++++++++++++++++++++++ mm/oom_kill.c | 25 ++-- mm/page_counter.c | 30 +++++ 8 files changed, 334 insertions(+), 21 deletions(-) -- 2.14.1