From 0c8648d9554d49a612a1c0c01912fe60d1577fa8 Mon Sep 17 00:00:00 2001 From: Wenwei Tao Date: Wed, 11 Sep 2019 14:25:27 +0800 Subject: [PATCH 0761/2944] alinux: doc: alibaba: Add priority oom descriptions Add "memory.priority" and "memory.use_priority_oom" descriptions. Signed-off-by: Wenwei Tao Reviewed-by: Yang Shi --- Documentation/alibaba/interfaces.rst | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/Documentation/alibaba/interfaces.rst b/Documentation/alibaba/interfaces.rst index e874e8d..4cd82a2 100644 --- a/Documentation/alibaba/interfaces.rst +++ b/Documentation/alibaba/interfaces.rst @@ -122,3 +122,48 @@ zombie memcgs reaper - /sys/kernel/mm/memcg_reaper/reap users write "1" to trigger one round of zombie memcg reaping. + +memory.priority +=============== + Under memory pressure, reclaim and oom would happen, with multiple + cgroups exist in one system, we might want some of the cgroups's memory + or tasks survived the reclaim and oom while there are other candidates. + + The "memory.low" and "memory.min" make that happen during reclaim, this + "memory.priority" introduces a priority oom to meet above requirement + in oom. + + The priority value is from 0 to 12, the higher number the higher priority. + The priority is among siblings, it is not global priority, by this we can + map these 13 priorities to the tens of thousands of memcgs. + + When oom happens it first chooses the lowest priority memcg as victim then + uses the kernel default algorithm(see function oom_evaluate_task()) to select + bad process from the victim memcg. + + For example:: + + The following hierarchy: + root + / \ + A B + / \ / \ + C D E F + + priority: + A: 10, B: 8 + C: 5, D: 6, E: 7, F: 8 + + When oom happens in root, it first iterates its two children A and B, and selects + B as next iteration root since B's priority is lower than A, subsequent victim + selection is limit in the B's subtree. E is selected as victim memcg finally, since + its priority is lower than its sibling. + + This priority oom works both for memcg and global oom. For global oom the root is + root memcg. + +memory.use_priority_oom +======================= + This file is used to enable/disable priority oom. + + Write "1" to enable the priority oom and "0" to disable it. -- 1.8.3.1