diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2010-05-26 17:42:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-27 12:12:43 -0400 |
commit | 9490ff275606da012d5b373342a49610ad61cb81 (patch) | |
tree | 037993e807654da633776066129b001f8bae7d1d /Documentation/cgroups/memory.txt | |
parent | dc98df5a1b7be402a0e1c71f1b89ccf249ac15ee (diff) |
memcg: oom notifier
Considering containers or other resource management softwares in userland,
event notification of OOM in memcg should be implemented. Now, memcg has
"threshold" notifier which uses eventfd, we can make use of it for oom
notification.
This patch adds oom notification eventfd callback for memcg. The usage is
very similar to threshold notifier, but control file is memory.oom_control
and no arguments other than eventfd is required.
% cgroup_event_notifier /cgroup/A/memory.oom_control dummy
(About cgroup_event_notifier, see Documentation/cgroup/)
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: David Rientjes <rientjes@google.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/cgroups/memory.txt')
-rw-r--r-- | Documentation/cgroups/memory.txt | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 6cab1f29da4c..eac22d3b2f7b 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt | |||
@@ -184,6 +184,9 @@ limits on the root cgroup. | |||
184 | 184 | ||
185 | Note2: When panic_on_oom is set to "2", the whole system will panic. | 185 | Note2: When panic_on_oom is set to "2", the whole system will panic. |
186 | 186 | ||
187 | When oom event notifier is registered, event will be delivered. | ||
188 | (See oom_control section) | ||
189 | |||
187 | 2. Locking | 190 | 2. Locking |
188 | 191 | ||
189 | The memory controller uses the following hierarchy | 192 | The memory controller uses the following hierarchy |
@@ -488,7 +491,22 @@ threshold in any direction. | |||
488 | 491 | ||
489 | It's applicable for root and non-root cgroup. | 492 | It's applicable for root and non-root cgroup. |
490 | 493 | ||
491 | 10. TODO | 494 | 10. OOM Control |
495 | |||
496 | Memory controler implements oom notifier using cgroup notification | ||
497 | API (See cgroups.txt). It allows to register multiple oom notification | ||
498 | delivery and gets notification when oom happens. | ||
499 | |||
500 | To register a notifier, application need: | ||
501 | - create an eventfd using eventfd(2) | ||
502 | - open memory.oom_control file | ||
503 | - write string like "<event_fd> <memory.oom_control>" to cgroup.event_control | ||
504 | |||
505 | Application will be notifier through eventfd when oom happens. | ||
506 | OOM notification doesn't work for root cgroup. | ||
507 | |||
508 | |||
509 | 11. TODO | ||
492 | 510 | ||
493 | 1. Add support for accounting huge pages (as a separate controller) | 511 | 1. Add support for accounting huge pages (as a separate controller) |
494 | 2. Make per-cgroup scanner reclaim not-shared pages first | 512 | 2. Make per-cgroup scanner reclaim not-shared pages first |