linux/Documentation
Anton Vorontsov 70ddf637ee 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:54:38 -07:00
..
ABI USB patches for 3.10-rc1 2013-04-29 12:19:23 -07:00
DocBook tty: Documentation: fix a path in a DocBook template 2013-04-03 11:45:38 -07:00
EDID
PCI
RCU
accounting
acpi ACPI / Documentation: refer to correct file for acpi_platform_device_ids[] table 2013-02-13 13:43:02 +01:00
aoe
arm
arm64
auxdisplay
backlight backlight: lp855x_bl: support new LP8557 device 2013-02-21 17:22:25 -08:00
blackfin
block
blockdev nbd: update documentation and link to mailinglist 2013-02-27 19:10:22 -08:00
bus-devices
cdrom
cgroups memcg: add memory.pressure_level events 2013-04-29 15:54:38 -07:00
connector
console
cpu-freq
cpuidle
cris
crypto
development-process
device-mapper md updates for 3.9 2013-03-05 17:22:08 -08:00
devicetree USB patches for 3.10-rc1 2013-04-29 12:19:23 -07:00
driver-model
dvb
early-userspace
extcon
fault-injection
fb
filesystems Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
firmware_class
frv
hid
hwmon hwmon: (tmp401) Add support for TMP432 2013-04-21 08:56:48 -07:00
i2c i2c: Fix my e-mail address in drivers and documentation 2013-03-22 11:18:34 +01:00
i2o
ia64 Fix example error_injection_tool 2013-04-02 09:39:55 -07:00
ide
infiniband
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2013-03-11 07:49:37 -07:00
ioctl USB: cdc-wdm: implement IOCTL_WDM_MAX_COMMAND 2013-03-25 13:32:20 -07:00
isdn
ja_JP
kbuild Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild 2013-02-27 12:28:30 -08:00
kdump Add size restriction to the kdump documentation 2013-04-02 09:40:03 -07:00
ko_KR
laptops
leds
m68k
make
memory-devices
metag metag: Basic documentation 2013-03-02 20:09:50 +00:00
mips
misc-devices mei: bus: Add device enabling and disabling API 2013-04-08 16:57:15 -07:00
mmc
mn10300
mtd
namespaces
netlabel
networking ipvs: add backup_only flag to avoid loops 2013-03-19 21:21:51 +09:00
nfc
parisc
pcmcia
power PM / OPP: improve introductory documentation 2013-03-04 14:23:11 +01:00
powerpc powerpc: Documentation for transactional memory on powerpc 2013-02-15 17:02:25 +11:00
pps
prctl
pti
ptp
rapidio
s390 s390/s390dbf.txt: Add doc: Debug views are removed in debug_unregister() 2013-04-17 14:07:25 +02:00
scheduler
scsi [SCSI] qla2xxx: Update copyright dates information in LICENSE.qla2xxx file. 2013-04-06 11:31:30 +01:00
security
serial
sh
sound Revert "ALSA: hda - Allow power_save_controller option override DCAPS" 2013-04-04 15:35:39 +02:00
spi
sysctl mm: replace hardcoded 3% with admin_reserve_pages knob 2013-04-29 15:54:36 -07:00
target
thermal Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux 2013-02-28 19:48:26 -08:00
timers
trace Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-03-11 07:54:29 -07:00
usb USB: remove CONFIG_USB_SUSPEND from Documentation 2013-03-28 14:45:56 -07:00
vDSO
video4linux [media] radio-si470x doc: add info about v4l2-ctl and sox+alsa 2013-02-13 17:33:20 -02:00
virtual Merge tag 'kvm-3.9-1' of git://git.kernel.org/pub/scm/virt/kvm/kvm 2013-02-24 13:07:18 -08:00
vm mm: limit growth of 3% hardcoded other user reserve 2013-04-29 15:54:36 -07:00
w1 w1: w1_therm: Add force-pullup option for "broken" sensors 2013-02-18 13:55:24 -08:00
watchdog watchdog: core: dt: add support for the timeout-sec dt property 2013-03-01 12:48:36 +01:00
wimax
x86 Merge branch 'x86/microcode' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-02-22 19:22:52 -08:00
xtensa
zh_CN Driver core patches for 3.9-rc1 2013-02-21 12:05:51 -08:00
.gitignore
00-INDEX ImgTec Meta architecture changes for v3.9-rc1 2013-03-03 12:06:09 -08:00
BUG-HUNTING
Changes
CodingStyle
DMA-API-HOWTO.txt Documentation/DMA-API-HOWTO.txt: fix typo 2013-02-27 19:10:23 -08:00
DMA-API.txt
DMA-ISA-LPC.txt
DMA-attributes.txt
HOWTO
IPMI.txt ipmi: add options to disable openfirmware and PCI scanning 2013-02-27 19:10:21 -08:00
IRQ-affinity.txt
IRQ-domain.txt
IRQ.txt
Intel-IOMMU.txt
Makefile
ManagementStyle
SAK.txt
SM501.txt
SecurityBugs
SubmitChecklist
SubmittingDrivers
SubmittingPatches Randy has moved 2013-03-08 15:05:34 -08:00
VGA-softcursor.txt
applying-patches.txt
atomic_ops.txt
bad_memory.txt
basic_profiling.txt
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
cachetlb.txt
circular-buffers.txt
clk.txt
coccinelle.txt coccicheck: Allow the user to give a V= (verbose) argument 2013-02-22 11:39:13 +01:00
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
digsig.txt
dma-buf-sharing.txt dma-buf: implement vmap refcounting in the interface logic 2013-02-27 15:13:36 +05:30
dmaengine.txt
dontdiff
dynamic-debug-howto.txt
edac.txt
eisa.txt
email-clients.txt
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gpio.txt
highuid.txt
hw_random.txt
hwspinlock.txt
init.txt
initrd.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kernel-doc-nano-HOWTO.txt
kernel-docs.txt
kernel-parameters.txt Merge branch 'x86-kdump-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-04-20 18:40:36 -07:00
kmemcheck.txt
kmemleak.txt
kobject.txt
kprobes.txt
kref.txt
ldm.txt
local_ops.txt
lockdep-design.txt
lockstat.txt locking/stat: Fix a typo 2013-02-19 08:42:37 +01:00
lockup-watchdogs.txt
logo.gif
logo.txt
magic-number.txt
md.txt
media-framework.txt [media] Documentation/media-framework.txt: fix a sentence 2013-02-08 13:27:13 -02:00
memory-barriers.txt
memory-hotplug.txt
mono.txt
mutex-design.txt
nommu-mmap.txt
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
percpu-rw-semaphore.txt
pi-futex.txt
pinctrl.txt pinctrl: document the "GPIO mode" pitfall 2013-03-18 11:03:29 +01:00
pnp.txt
preempt-locking.txt
printk-formats.txt Randy has moved 2013-03-08 15:05:34 -08:00
pwm.txt
ramoops.txt
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rt-mutex-design.txt
rt-mutex.txt
rtc.txt
serial-console.txt
sgi-ioc4.txt
sgi-visws.txt
smsc_ece1099.txt
sparse.txt
spinlocks.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
static-keys.txt
svga.txt
sysfs-rules.txt
sysrq.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vfio.txt
vgaarbiter.txt
video-output.txt
vme_api.txt
volatile-considered-harmful.txt
workqueue.txt
xz.txt
zorro.txt