kernel-hacking-2024-linux-s.../Documentation
Chris Down 9852ae3fe5 mm, memcg: consider subtrees in memory.events
memory.stat and other files already consider subtrees in their output, and
we should too in order to not present an inconsistent interface.

The current situation is fairly confusing, because people interacting with
cgroups expect hierarchical behaviour in the vein of memory.stat,
cgroup.events, and other files.  For example, this causes confusion when
debugging reclaim events under low, as currently these always read "0" at
non-leaf memcg nodes, which frequently causes people to misdiagnose breach
behaviour.  The same confusion applies to other counters in this file when
debugging issues.

Aggregation is done at write time instead of at read-time since these
counters aren't hot (unlike memory.stat which is per-page, so it does it
at read time), and it makes sense to bundle this with the file
notifications.

After this patch, events are propagated up the hierarchy:

    [root@ktst ~]# cat /sys/fs/cgroup/system.slice/memory.events
    low 0
    high 0
    max 0
    oom 0
    oom_kill 0
    [root@ktst ~]# systemd-run -p MemoryMax=1 true
    Running as unit: run-r251162a189fb4562b9dabfdc9b0422f5.service
    [root@ktst ~]# cat /sys/fs/cgroup/system.slice/memory.events
    low 0
    high 0
    max 7
    oom 1
    oom_kill 1

As this is a change in behaviour, this can be reverted to the old
behaviour by mounting with the `memory_localevents' flag set.  However, we
use the new behaviour by default as there's a lack of evidence that there
are any current users of memory.events that would find this change
undesirable.

akpm: this is a behaviour change, so Cc:stable.  THis is so that
forthcoming distros which use cgroup v2 are more likely to pick up the
revised behaviour.

Link: http://lkml.kernel.org/r/20190208224419.GA24772@chrisdown.name
Signed-off-by: Chris Down <chris@chrisdown.name>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Roman Gushchin <guro@fb.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-06-01 15:51:31 -07:00
..
ABI Documentation: net-sysfs: Remove duplicate PHY device documentation 2019-05-28 17:26:44 -07:00
accelerators
accounting psi: introduce psi monitor 2019-05-14 19:52:48 -07:00
acpi/dsd
admin-guide mm, memcg: consider subtrees in memory.events 2019-06-01 15:51:31 -07:00
aoe
arm
arm64 arm64: Handle erratum 1418040 as a superset of erratum 1188873 2019-05-23 15:40:30 +01:00
auxdisplay
backlight
block
blockdev
bpf bpf: btf: fix the brackets of BTF_INT_OFFSET() 2019-05-14 10:05:18 +02:00
bus-devices
cdrom
cgroup-v1
cma
connector
console
core-api lib: Move mathematic helpers to separate folder 2019-05-14 19:52:49 -07:00
cpu-freq
crypto
dev-tools gcov: docs: add a note on GCC vs Clang differences 2019-05-14 19:52:51 -07:00
device-mapper
devicetree dt: bindings: mtd: replace references to nand.txt with nand-controller.yaml 2019-05-22 09:08:20 -05:00
doc-guide
driver-api counter: fix Documentation build error due to incorrect source file name 2019-05-20 13:18:45 -06:00
driver-model i2c: core: add device-managed version of i2c_new_dummy 2019-05-17 19:29:40 +02:00
early-userspace
EDID
extcon
fault-injection
fb
features
filesystems autofs: add description of ignore pseudo mount option 2019-05-14 19:52:50 -07:00
firmware-guide docs: fix multiple doc build warnings in enumeration.rst 2019-05-23 09:27:39 -06:00
firmware_class
fmc
fpga
gpio
gpu
hid
hwmon
i2c
ia64
ide
iio
infiniband
input
interconnect
ioctl
isdn
kbuild kbuild: drop support for cc-ldoption 2019-05-21 00:02:59 +09:00
kdump Documentation: kdump: fix minor typo 2019-05-21 09:31:28 -06:00
kernel-hacking
laptops
leds
lightnvm
livepatch
locking
m68k
maintainer
md
media media updates for v5.2-rc1 2019-05-16 11:57:16 -07:00
memory-devices
mic
mips
misc-devices
mmc
mtd
namespaces
netlabel
networking Documentation: add TLS offload documentation 2019-05-22 12:18:20 -07:00
nfc
nios2
nvdimm
nvmem
openrisc
parisc
PCI
pcmcia
perf
phy
platform
power
powerpc
pps
process
pti
ptp
rapidio
RCU
riscv
s390
scheduler
scsi
security
serial
sh
sound
sparc docs: sparc: convert to ReST 2019-05-08 17:13:35 -07:00
sphinx doc: Cope with the deprecation of AutoReporter 2019-05-23 09:23:11 -06:00
sphinx-static
spi
sysctl userfaultfd/sysctl: add vm.unprivileged_userfaultfd 2019-05-14 09:47:45 -07:00
target
thermal
timers
trace The major changes in this tracing update includes: 2019-05-15 16:05:47 -07:00
translations Some late arriving documentation changes. In particular, this contains the 2019-05-10 13:24:53 -04:00
usb USB: rio500: update Documentation 2019-05-21 10:11:19 +02:00
userspace-api
virtual * ARM: support for SVE and Pointer Authentication in guests, PMU improvements 2019-05-17 10:33:30 -07:00
vm mm: fix Documentation/vm/hmm.rst Sphinx warnings 2019-06-01 15:51:31 -07:00
w1
watchdog
wimax
x86 x86/speculation/mds: Improve CPU buffer clear documentation 2019-05-16 09:05:12 +02:00
xilinx
xtensa
.gitignore
atomic_bitops.txt
atomic_t.txt
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
Changes
clearing-warn-once.txt
CodingStyle
conf.py docs: Fix conf.py for Sphinx 2.0 2019-05-24 09:09:32 -06:00
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
digsig.txt
DMA-API-HOWTO.txt DMA mapping updates for 5.2 2019-05-09 08:40:55 -07:00
DMA-API.txt
DMA-attributes.txt
DMA-ISA-LPC.txt
docutils.conf
dontdiff
efi-stub.txt
eisa.txt
futex-requeue-pi.txt
gcc-plugins.txt
highuid.txt
hw_random.txt
hwspinlock.txt
index.rst Merge branch 'x86-mds-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-05-14 07:57:29 -07:00
Intel-IOMMU.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt
IRQ.txt
irqflags-tracing.txt
isa.txt
isapnp.txt
kernel-per-CPU-kthreads.txt
kobject.txt
kprobes.txt
kref.txt
ldm.txt
lockup-watchdogs.txt
logo.gif
logo.txt
lsm.txt
lzo.txt
mailbox.txt
Makefile
memory-barriers.txt
men-chameleon-bus.txt
nommu-mmap.txt
ntb.txt
numastat.txt
packing.txt
padata.txt
parport-lowlevel.txt
percpu-rw-semaphore.txt
phy.txt
pi-futex.txt
pnp.txt
preempt-locking.txt
pwm.txt
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rtc.txt
SAK.txt
sgi-ioc4.txt
siphash.txt
SM501.txt
smsc_ece1099.txt
speculation.txt
static-keys.txt
SubmittingPatches
svga.txt
switchtec.txt
sync_file.txt
tee.txt
this_cpu_ops.txt
unaligned-memory-access.txt
vfio-mediated-device.txt
vfio.txt
video-output.txt
xillybus.txt
xz.txt
zorro.txt