mm/memcontrol: update documentation about invoking oom killer
Subsystems (3)
PATCH 1/1 mm/memcontrol: update documentation about invoking oom killer
Since commit 29ef680ae7c2 ("memcg, oom: move out_of_memory back to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.
--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Documentation/admin-guide/cgroup-v2.rst +7 -2
@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault. + disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iff + shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds. This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-order
Quoted 15 lines · Konstantin Khlebnikov
Since commit
29ef680ae7c2("memcg, oom: moveout_of_memoryback to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.Fixes 8e675f7af507 ("mm/oom_kill: count global and memory cgroup oom kills")Signed-off-by Konstantin Khlebnikov <[email protected]>--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Documentation/admin-guide/cgroup-v2.rst +0
-0
Documentation/admin-guide/cgroup-v2.rst PAGE_SIZE multiple when read back. · line 1224
Quoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +3
-2@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault. + disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iff
Hello Konstantin,
iff --> if :-)
Best regards
Damian
Quoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +4
-0+ shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds. This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-order
Quoted 26 lines · Damian Tometzki
Quoted 15 lines · Konstantin Khlebnikov
Since commit
29ef680ae7c2("memcg, oom: moveout_of_memoryback to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.Fixes 8e675f7af507 ("mm/oom_kill: count global and memory cgroup oom kills")Signed-off-by Konstantin Khlebnikov <[email protected]>--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Documentation/admin-guide/cgroup-v2.rst +0
-0Documentation/admin-guide/cgroup-v2.rst PAGE_SIZE multiple when read back. · line 1224
Quoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +3
-2@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault. + disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iffHello Konstantin,
Quoted 2 lines
iff --> if :-)
This "iff" is shortened "if and only if".
https://en.wikipedia.org/wiki/If_and_only_if
Quoted 12 lines
Best regards
DamianQuoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +4
-0+ shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds. This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-order
Quoted 29 lines · Konstantin Khlebnikov
Quoted 26 lines · Damian Tometzki
Quoted 15 lines · Konstantin Khlebnikov
Since commit
29ef680ae7c2("memcg, oom: moveout_of_memoryback to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.Fixes 8e675f7af507 ("mm/oom_kill: count global and memory cgroup oom kills")Signed-off-by Konstantin Khlebnikov <[email protected]>--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Documentation/admin-guide/cgroup-v2.rst +0
-0Documentation/admin-guide/cgroup-v2.rst PAGE_SIZE multiple when read back. · line 1224
Quoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +3
-2@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault. + disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iffHello Konstantin,
Quoted 5 lines
Quoted 2 lines
iff --> if :-)
This "iff" is shortened "if and only if".
https://en.wikipedia.org/wiki/If_and_only_if
good to know :-)
Quoted 13 lines
Quoted 13 lines
Best regards
DamianQuoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +4
-0+ shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds. This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-order
Quoted 20 lines · Konstantin Khlebnikov
Since commit
29ef680ae7c2("memcg, oom: moveout_of_memoryback to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.Fixes 8e675f7af507 ("mm/oom_kill: count global and memory cgroup oom kills")Signed-off-by Konstantin Khlebnikov <[email protected]>--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Documentation/admin-guide/cgroup-v2.rst +0
-2@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault.
Documentation/admin-guide/cgroup-v2.rst PAGE_SIZE multiple when read back. · line 1231
Quoted 10 lines
Documentation/admin-guide/cgroup-v2.rst +7
-0+ disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iff + shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds. This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-order
The previous text is obviously incorrect for today's kernels, but I'm curious if we should be conflating the documentation here by describing the pre-4.19 behavior. OOM killing no longer happens only on page fault so maybe better to document the exact behavior today and not attempt to describe differences with previous versions?
Quoted 30 lines · David Rientjes
Quoted 28 lines · Konstantin Khlebnikov
Since commit
29ef680ae7c2("memcg, oom: moveout_of_memoryback to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.Fixes 8e675f7af507 ("mm/oom_kill: count global and memory cgroup oom kills")Signed-off-by Konstantin Khlebnikov <[email protected]>--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Documentation/admin-guide/cgroup-v2.rst +7
-2@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault. + disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iff + shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds.
Quoted 9 lines
Documentation/admin-guide/cgroup-v2.rst PAGE_SIZE multiple when read back. · line 1231
Quoted 2 lines
Documentation/admin-guide/cgroup-v2.rst +0
-0This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-orderThe previous text is obviously incorrect for today's kernels, but I'm curious if we should be conflating the documentation here by describing the pre-4.19 behavior. OOM killing no longer happens only on page fault so maybe better to document the exact behavior today and not attempt to describe differences with previous versions?
Previous behaviour was here for ages and 4.19 is not so old. According too https://www.kernel.org/category/releases.html pre-4.19 will be maintained for couple years at least. Let's keep this tombstone.
I've seen a lot of strange side effects of old behaviour. Most obscure was a hang inside libc fork() when clone(CLONE_CHILD_SETTID) silently fails to set child pid =)
https://lore.kernel.org/lkml/20150206162301.18031.32251.stgit@buzz/
Quoted 5 lines · Konstantin Khlebnikov
Since commit
29ef680ae7c2("memcg, oom: moveout_of_memoryback to the charge path") memcg invokes oom killer not only for user page-faults. This means 0-order allocation will either succeed or task get killed.Fixes 8e675f7af507 ("mm/oom_kill: count global and memory cgroup oom kills")
Is this really appropriate? 8e675f7af507 was correct at the time. It was 29ef680ae7c2 that hasn't updated the documentation. I would just drop the Fixes tag.
Quoted 10 lines
Signed-off-by Konstantin Khlebnikov <[email protected]>--- Documentation/admin-guide/cgroup-v2.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)Documentation/admin-guide/cgroup-v2.rst +0
-0
Documentation/admin-guide/cgroup-v2.rst PAGE_SIZE multiple when read back. · line 1224
Quoted 8 lines
Documentation/admin-guide/cgroup-v2.rst +3
-2@@ -1219,8 +1219,13 @@ PAGE_SIZE multiple when read back. Failed allocation in its turn could be returned into userspace as -ENOMEM or silently ignored in cases like - disk readahead. For now OOM in memory cgroup kills - tasks iff shortage has happened inside page fault. + disk readahead. + + Before 4.19 OOM in memory cgroup killed tasks iff
I would go with Kernels between 3.12 and 4.19 invoked the oom killer only if shortage has happened inside page fault.
Quoted 7 lines
Documentation/admin-guide/cgroup-v2.rst +4
-0+ shortage has happened inside page fault, random + syscall may fail with ENOMEM or EFAULT. Since 4.19 + failed memory cgroup allocation invokes oom killer and + keeps retrying until it succeeds. This event is not raised if the OOM killer is not considered as an option, e.g. for failed high-order
Signature · 2 lines
Michal Hocko SUSE Labs