WSL2-Linux-Kernel/Documentation
Kirill A. Shutemov 0dea116876 cgroup: implement eventfd-based generic API for notifications
This patchset introduces eventfd-based API for notifications in cgroups
and implements memory notifications on top of it.

It uses statistics in memory controler to track memory usage.

Output of time(1) on building kernel on tmpfs:

Root cgroup before changes:
	make -j2  506.37 user 60.93s system 193% cpu 4:52.77 total
Non-root cgroup before changes:
	make -j2  507.14 user 62.66s system 193% cpu 4:54.74 total
Root cgroup after changes (0 thresholds):
	make -j2  507.13 user 62.20s system 193% cpu 4:53.55 total
Non-root cgroup after changes (0 thresholds):
	make -j2  507.70 user 64.20s system 193% cpu 4:55.70 total
Root cgroup after changes (1 thresholds, never crossed):
	make -j2  506.97 user 62.20s system 193% cpu 4:53.90 total
Non-root cgroup after changes (1 thresholds, never crossed):
	make -j2  507.55 user 64.08s system 193% cpu 4:55.63 total

This patch:

Introduce the write-only file "cgroup.event_control" in every cgroup.

To register new notification handler you need:
- create an eventfd;
- open a control file to be monitored. Callbacks register_event() and
  unregister_event() must be defined for the control file;
- write "<event_fd> <control_fd> <args>" to cgroup.event_control.
  Interpretation of args is defined by control file implementation;

eventfd will be woken up by control file implementation or when the
cgroup is removed.

To unregister notification handler just close eventfd.

If you need notification functionality for a control file you have to
implement callbacks register_event() and unregister_event() in the
struct cftype.

[kamezawa.hiroyu@jp.fujitsu.com: Kconfig fix]
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Paul Menage <menage@google.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Cc: Dan Malek <dan@embeddedalley.com>
Cc: Vladislav Buzov <vbuzov@embeddedalley.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Alexander Shishkin <virtuoso@slind.org>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-03-12 15:52:37 -08:00
..
ABI mm: document /sys/devices/system/node/nodeX 2010-03-06 11:26:26 -08:00
DocBook docbook: fix errors from x86 headers merger 2010-03-03 07:32:39 -08:00
PCI
RCU
accounting
acpi
aoe
arm
auxdisplay
blackfin
block
blockdev
cdrom
cgroups cgroup: implement eventfd-based generic API for notifications 2010-03-12 15:52:37 -08:00
connector
console
cpu-freq
cpuidle
cris
crypto
development-process
device-mapper dm: document when snapshot has finished merging 2010-03-06 02:29:56 +00:00
driver-model
dvb
early-userspace
fault-injection lkdtm: add debugfs access and loosen KPROBE ties 2010-03-06 11:26:32 -08:00
fb
filesystems Documentation/fs/: split txt and source files 2010-03-12 15:52:35 -08:00
firmware_class
frv
hwmon hwmon: Remove the deprecated adt7473 driver 2010-03-05 22:17:26 +01:00
i2c i2c: Document the message size limit 2010-03-02 12:23:49 +01:00
i2o
ia64
ide
infiniband
input Merge branch 'next' into for-linus 2010-02-28 23:55:20 -08:00
ioctl USB: vstusb.c: removal of driver for Vernier Software & Technology, Inc., devices and spectrometers 2010-03-02 14:55:08 -08:00
isdn
ja_JP
kbuild
kdump
ko_KR
kvm KVM: trivial document fixes 2010-03-01 12:35:43 -03:00
laptops Documentation/laptop/: split txt and source files 2010-03-12 15:52:35 -08:00
lguest
m68k
make
mips
misc-devices
mn10300
mtd
namespaces
netlabel
networking Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6 2010-03-03 08:48:58 -08:00
parisc
pcmcia
power PM: Provide generic subsystem-level callbacks 2010-03-06 21:28:37 +01:00
powerpc powerpc: doc/dts-bindings: update doc of FSL I2C bindings 2010-03-07 22:03:10 +00:00
pps
prctl
s390
scheduler
scsi
serial
sh
sound Merge branch 'topic/misc' into for-linus 2010-03-08 09:35:50 +01:00
sparc
spi
sysctl
telephony
thermal
timers Documentation/timers/: split txt and source files 2010-03-12 15:52:35 -08:00
trace Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-02-28 10:20:25 -08:00
uml
usb USB: convert to the runtime PM framework 2010-03-02 14:54:12 -08:00
video4linux
vm Documentation/vm/: split txt and source files 2010-03-12 15:52:35 -08:00
w1
watchdog
wimax
x86
zh_CN
00-INDEX
BUG-HUNTING
Changes
CodingStyle
DMA-API.txt
DMA-ISA-LPC.txt
DMA-attributes.txt
HOWTO HOWTO: Updates on subsystem trees, patchwork, -next (vs. -mm) 2010-03-07 17:04:49 -08:00
IO-mapping.txt
IPMI.txt
IRQ-affinity.txt
IRQ.txt
Intel-IOMMU.txt
Makefile Documentation/fs/: split txt and source files 2010-03-12 15:52:35 -08:00
ManagementStyle
SAK.txt
SELinux.txt
SM501.txt
SecurityBugs
Smack.txt
SubmitChecklist Documentation/SubmitChecklist: add rule #1 2010-03-12 15:52:35 -08:00
SubmittingDrivers
SubmittingPatches
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
cachetlb.txt Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm 2010-03-01 09:15:15 -08:00
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
credentials.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
dmaengine.txt
dontdiff
dynamic-debug-howto.txt
edac.txt
eisa.txt
email-clients.txt Documentation/email-clients.txt: update gmail information 2010-03-12 15:52:35 -08:00
feature-removal-schedule.txt Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging 2010-03-06 11:33:09 -08:00
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
gpio.txt gpio: introduce gpio_request_one() and friends 2010-03-06 11:26:48 -08:00
highuid.txt
hw_random.txt
init.txt init/main.c: improve usability in case of init binary failure 2010-03-06 11:26:29 -08:00
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-mrst-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2010-03-07 15:59:39 -08:00
keys-request-key.txt
keys.txt
kmemcheck.txt
kmemleak.txt
kobject.txt Driver core: Constify struct sysfs_ops in struct kobj_type 2010-03-07 17:04:49 -08:00
kprobes.txt
kref.txt
ldm.txt
leds-class.txt
leds-lp3944.txt
local_ops.txt
lockdep-design.txt
lockstat.txt
logo.gif
logo.txt
magic-number.txt
mca.txt
md.txt
memory-barriers.txt
memory-hotplug.txt
memory.txt
mono.txt
mutex-design.txt
nmi_watchdog.txt
nommu-mmap.txt
numastat.txt
oops-tracing.txt
parport-lowlevel.txt
parport.txt
pi-futex.txt
pnp.txt
preempt-locking.txt
printk-formats.txt
prio_tree.txt
rbtree.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rt-mutex-design.txt
rt-mutex.txt
rtc.txt
serial-console.txt
sgi-ioc4.txt
sgi-visws.txt
slow-work.txt
sparse.txt
spinlocks.txt
stable_api_nonsense.txt
stable_kernel_rules.txt
svga.txt
sysfs-rules.txt
sysrq.txt
tomoyo.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
vgaarbiter.txt
video-output.txt
volatile-considered-harmful.txt
zorro.txt