2008-03-04 14:28:39 -08:00
|
|
|
|
|
|
|
|
|
2011-06-15 13:00:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-04-12 12:49:10 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
memcg: add memory.pressure_level events
With this patch userland applications that want to maintain the
interactivity/memory allocation cost can use the pressure level
notifications. The levels are defined like this:
The "low" level means that the system is reclaiming memory for new
allocations. Monitoring this reclaiming activity might be useful for
maintaining cache level. Upon notification, the program (typically
"Activity Manager") might analyze vmstat and act in advance (i.e.
prematurely shutdown unimportant services).
The "medium" level means that the system is experiencing medium memory
pressure, the system might be making swap, paging out active file
caches, etc. Upon this event applications may decide to further analyze
vmstat/zoneinfo/memcg or internal memory usage statistics and free any
resources that can be easily reconstructed or re-read from a disk.
The "critical" level means that the system is actively thrashing, it is
about to out of memory (OOM) or even the in-kernel OOM killer is on its
way to trigger. Applications should do whatever they can to help the
system. It might be too late to consult with vmstat or any other
statistics, so it's advisable to take an immediate action.
The events are propagated upward until the event is handled, i.e. the
events are not pass-through. Here is what this means: for example you
have three cgroups: A->B->C. Now you set up an event listener on
cgroups A, B and C, and suppose group C experiences some pressure. In
this situation, only group C will receive the notification, i.e. groups
A and B will not receive it. This is done to avoid excessive
"broadcasting" of messages, which disturbs the system and which is
especially bad if we are low on memory or thrashing. So, organize the
cgroups wisely, or propagate the events manually (or, ask us to
implement the pass-through events, explaining why would you need them.)
Performance wise, the memory pressure notifications feature itself is
lightweight and does not require much of bookkeeping, in contrast to the
rest of memcg features. Unfortunately, as of current memcg
implementation, pages accounting is an inseparable part and cannot be
turned off. The good news is that there are some efforts[1] to improve
the situation; plus, implementing the same, fully API-compatible[2]
interface for CONFIG_MEMCG=n case (e.g. embedded) is also a viable
option, so it will not require any changes on the userland side.
[1] http://permalink.gmane.org/gmane.linux.kernel.cgroups/6291
[2] http://lkml.org/lkml/2013/2/21/454
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix CONFIG_CGROPUPS=n warnings]
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Leonid Moiseichuk <leonid.moiseichuk@nokia.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29 15:08:31 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2011-12-22 01:02:27 +00:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-27 15:26:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-01-12 17:18:24 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memcg: add memory.pressure_level events
With this patch userland applications that want to maintain the
interactivity/memory allocation cost can use the pressure level
notifications. The levels are defined like this:
The "low" level means that the system is reclaiming memory for new
allocations. Monitoring this reclaiming activity might be useful for
maintaining cache level. Upon notification, the program (typically
"Activity Manager") might analyze vmstat and act in advance (i.e.
prematurely shutdown unimportant services).
The "medium" level means that the system is experiencing medium memory
pressure, the system might be making swap, paging out active file
caches, etc. Upon this event applications may decide to further analyze
vmstat/zoneinfo/memcg or internal memory usage statistics and free any
resources that can be easily reconstructed or re-read from a disk.
The "critical" level means that the system is actively thrashing, it is
about to out of memory (OOM) or even the in-kernel OOM killer is on its
way to trigger. Applications should do whatever they can to help the
system. It might be too late to consult with vmstat or any other
statistics, so it's advisable to take an immediate action.
The events are propagated upward until the event is handled, i.e. the
events are not pass-through. Here is what this means: for example you
have three cgroups: A->B->C. Now you set up an event listener on
cgroups A, B and C, and suppose group C experiences some pressure. In
this situation, only group C will receive the notification, i.e. groups
A and B will not receive it. This is done to avoid excessive
"broadcasting" of messages, which disturbs the system and which is
especially bad if we are low on memory or thrashing. So, organize the
cgroups wisely, or propagate the events manually (or, ask us to
implement the pass-through events, explaining why would you need them.)
Performance wise, the memory pressure notifications feature itself is
lightweight and does not require much of bookkeeping, in contrast to the
rest of memcg features. Unfortunately, as of current memcg
implementation, pages accounting is an inseparable part and cannot be
turned off. The good news is that there are some efforts[1] to improve
the situation; plus, implementing the same, fully API-compatible[2]
interface for CONFIG_MEMCG=n case (e.g. embedded) is also a viable
option, so it will not require any changes on the userland side.
[1] http://permalink.gmane.org/gmane.linux.kernel.cgroups/6291
[2] http://lkml.org/lkml/2013/2/21/454
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix CONFIG_CGROPUPS=n warnings]
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Leonid Moiseichuk <leonid.moiseichuk@nokia.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29 15:08:31 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-15 15:08:16 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-11 21:47:06 +00:00
|
|
|
|
2011-12-11 21:47:07 +00:00
|
|
|
|
2012-07-31 16:43:21 -07:00
|
|
|
|
|
|
|
|
|
2011-12-11 21:47:01 +00:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-11 16:01:28 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-10-18 20:28:10 -07:00
|
|
|
|
2012-04-12 12:49:10 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2008-10-18 20:28:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2008-10-18 20:28:10 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memcg: fix/change behavior of shared anon at moving task
This patch changes memcg's behavior at task_move().
At task_move(), the kernel scans a task's page table and move the changes
for mapped pages from source cgroup to target cgroup. There has been a
bug at handling shared anonymous pages for a long time.
Before patch:
- The spec says 'shared anonymous pages are not moved.'
- The implementation was 'shared anonymoys pages may be moved'.
If page_mapcount <=2, shared anonymous pages's charge were moved.
After patch:
- The spec says 'all anonymous pages are moved'.
- The implementation is 'all anonymous pages are moved'.
Considering usage of memcg, this will not affect user's experience.
'shared anonymous' pages only exists between a tree of processes which
don't do exec(). Moving one of process without exec() seems not sane.
For example, libcgroup will not be affected by this change. (Anyway, no
one noticed the implementation for a long time...)
Below is a discussion log:
- current spec/implementation are complex
- Now, shared file caches are moved
- It adds unclear check as page_mapcount(). To do correct check,
we should check swap users, etc.
- No one notice this implementation behavior. So, no one get benefit
from the design.
- In general, once task is moved to a cgroup for running, it will not
be moved....
- Finally, we have control knob as memory.move_charge_at_immigrate.
Here is a patch to allow moving shared pages, completely. This makes
memcg simpler and fix current broken code.
Suggested-by: Hugh Dickins <hughd@google.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Glauber Costa <glommer@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-05-29 15:06:51 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-03-25 23:59:16 +01:00
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
2009-01-07 18:07:56 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-31 16:43:02 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
2009-06-17 16:27:19 -07:00
|
|
|
|
2011-06-15 13:00:47 -07:00
|
|
|
|
2009-06-17 16:27:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2009-09-23 15:56:32 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memcg: handle panic_on_oom=always case
Presently, if panic_on_oom=2, the whole system panics even if the oom
happend in some special situation (as cpuset, mempolicy....). Then,
panic_on_oom=2 means painc_on_oom_always.
Now, memcg doesn't check panic_on_oom flag. This patch adds a check.
BTW, how it's useful ?
kdump+panic_on_oom=2 is the last tool to investigate what happens in
oom-ed system. When a task is killed, the sysytem recovers and there will
be few hint to know what happnes. In mission critical system, oom should
never happen. Then, panic_on_oom=2+kdump is useful to avoid next OOM by
knowing precise information via snapshot.
TODO:
- For memcg, it's for isolate system's memory usage, oom-notiifer and
freeze_at_oom (or rest_at_oom) should be implemented. Then, management
daemon can do similar jobs (as kdump) or taking snapshot per cgroup.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Nick Piggin <npiggin@suse.de>
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-03-10 15:22:32 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2012-07-31 16:43:02 -07:00
|
|
|
|
2011-12-11 21:47:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-11 21:47:01 +00:00
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-11 21:47:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-18 14:23:08 -08:00
|
|
|
|
2013-05-08 16:56:16 -07:00
|
|
|
|
2012-12-18 14:23:08 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-11 21:47:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-11 21:47:01 +00:00
|
|
|
|
2011-12-11 21:47:04 +00:00
|
|
|
|
|
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-31 16:43:02 -07:00
|
|
|
|
|
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2011-06-15 12:59:45 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2011-06-15 12:59:45 -07:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2011-06-15 12:59:45 -07:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2009-06-17 16:27:20 -07:00
|
|
|
|
2009-09-23 15:56:32 -07:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
2011-06-15 12:59:45 -07:00
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2011-06-15 12:59:45 -07:00
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
|
|
|
|
|
2008-03-04 14:28:24 -08:00
|
|
|
|
2008-02-07 00:13:57 -08:00
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:14:41 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
2010-04-23 00:08:02 +02:00
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-29 15:07:04 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-29 15:07:04 -07:00
|
|
|
|
2009-01-07 18:08:00 -08:00
|
|
|
|
2009-01-07 18:07:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2012-05-29 15:07:04 -07:00
|
|
|
|
2009-01-07 18:07:55 -08:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2009-01-07 18:07:55 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-12-18 14:22:22 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-29 15:07:04 -07:00
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:22 -08:00
|
|
|
|
|
|
|
|
|
2011-09-14 16:21:58 -07:00
|
|
|
|
2009-01-07 18:08:22 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-04-13 14:40:15 -07:00
|
|
|
|
2013-05-07 16:18:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2012-01-12 17:18:27 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2013-06-19 15:34:29 +03:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2013-06-19 15:34:29 +03:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2009-04-13 14:40:15 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-29 15:06:26 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2009-04-13 14:40:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:22 -08:00
|
|
|
|
|
|
|
|
|
2009-04-13 14:40:15 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:22 -08:00
|
|
|
|
2009-01-07 18:08:24 -08:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2012-11-16 14:14:49 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:24 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:24 -08:00
|
|
|
|
2011-04-27 15:26:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2011-04-27 15:26:48 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-15 15:08:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
|
|
|
|
|
2011-06-15 15:08:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
2009-01-07 18:07:55 -08:00
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-06-15 13:00:47 -07:00
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
2011-06-15 13:00:47 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-02-16 17:51:23 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
memcg: handle panic_on_oom=always case
Presently, if panic_on_oom=2, the whole system panics even if the oom
happend in some special situation (as cpuset, mempolicy....). Then,
panic_on_oom=2 means painc_on_oom_always.
Now, memcg doesn't check panic_on_oom flag. This patch adds a check.
BTW, how it's useful ?
kdump+panic_on_oom=2 is the last tool to investigate what happens in
oom-ed system. When a task is killed, the sysytem recovers and there will
be few hint to know what happnes. In mission critical system, oom should
never happen. Then, panic_on_oom=2+kdump is useful to avoid next OOM by
knowing precise information via snapshot.
TODO:
- For memcg, it's for isolate system's memory usage, oom-notiifer and
freeze_at_oom (or rest_at_oom) should be implemented. Then, management
daemon can do similar jobs (as kdump) or taking snapshot per cgroup.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Nick Piggin <npiggin@suse.de>
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-03-10 15:22:32 -08:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-01-07 18:08:03 -08:00
|
|
|
|
2009-09-23 15:56:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-09-23 15:56:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2009-09-23 15:56:34 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2009-09-23 15:56:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2009-09-23 15:56:34 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:17 -08:00
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:39 -07:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:39 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:39 -07:00
|
|
|
|
2010-03-10 15:22:13 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:24 -08:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-03-10 15:22:24 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-03-10 15:22:24 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:37 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2010-05-26 14:42:37 -07:00
|
|
|
|
|
|
|
|
|
2012-10-08 16:33:09 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:37 -07:00
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2010-05-26 14:42:37 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-26 14:42:40 -07:00
|
|
|
|
2010-05-26 14:42:37 -07:00
|
|
|
|
2010-05-26 14:42:36 -07:00
|
|
|
|
memcg: add memory.pressure_level events
With this patch userland applications that want to maintain the
interactivity/memory allocation cost can use the pressure level
notifications. The levels are defined like this:
The "low" level means that the system is reclaiming memory for new
allocations. Monitoring this reclaiming activity might be useful for
maintaining cache level. Upon notification, the program (typically
"Activity Manager") might analyze vmstat and act in advance (i.e.
prematurely shutdown unimportant services).
The "medium" level means that the system is experiencing medium memory
pressure, the system might be making swap, paging out active file
caches, etc. Upon this event applications may decide to further analyze
vmstat/zoneinfo/memcg or internal memory usage statistics and free any
resources that can be easily reconstructed or re-read from a disk.
The "critical" level means that the system is actively thrashing, it is
about to out of memory (OOM) or even the in-kernel OOM killer is on its
way to trigger. Applications should do whatever they can to help the
system. It might be too late to consult with vmstat or any other
statistics, so it's advisable to take an immediate action.
The events are propagated upward until the event is handled, i.e. the
events are not pass-through. Here is what this means: for example you
have three cgroups: A->B->C. Now you set up an event listener on
cgroups A, B and C, and suppose group C experiences some pressure. In
this situation, only group C will receive the notification, i.e. groups
A and B will not receive it. This is done to avoid excessive
"broadcasting" of messages, which disturbs the system and which is
especially bad if we are low on memory or thrashing. So, organize the
cgroups wisely, or propagate the events manually (or, ask us to
implement the pass-through events, explaining why would you need them.)
Performance wise, the memory pressure notifications feature itself is
lightweight and does not require much of bookkeeping, in contrast to the
rest of memcg features. Unfortunately, as of current memcg
implementation, pages accounting is an inseparable part and cannot be
turned off. The good news is that there are some efforts[1] to improve
the situation; plus, implementing the same, fully API-compatible[2]
interface for CONFIG_MEMCG=n case (e.g. embedded) is also a viable
option, so it will not require any changes on the userland side.
[1] http://permalink.gmane.org/gmane.linux.kernel.cgroups/6291
[2] http://lkml.org/lkml/2013/2/21/454
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix CONFIG_CGROPUPS=n warnings]
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kirill A. Shutemov <kirill@shutemov.name>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Glauber Costa <glommer@parallels.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Leonid Moiseichuk <leonid.moiseichuk@nokia.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-29 15:08:31 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2013-07-03 15:02:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
2008-02-23 15:24:12 -08:00
|
|
|
|
|
|
|
|
|
2008-02-07 00:13:46 -08:00
|
|
|
|
|
|
|
|
|