kernel-hacking-2024-linux-s.../drivers
Vladimir Davydov 5d097056c9 kmemcg: account certain kmem allocations to memcg
Mark those kmem allocations that are known to be easily triggered from
userspace as __GFP_ACCOUNT/SLAB_ACCOUNT, which makes them accounted to
memcg.  For the list, see below:

 - threadinfo
 - task_struct
 - task_delay_info
 - pid
 - cred
 - mm_struct
 - vm_area_struct and vm_region (nommu)
 - anon_vma and anon_vma_chain
 - signal_struct
 - sighand_struct
 - fs_struct
 - files_struct
 - fdtable and fdtable->full_fds_bits
 - dentry and external_name
 - inode for all filesystems. This is the most tedious part, because
   most filesystems overwrite the alloc_inode method.

The list is far from complete, so feel free to add more objects.
Nevertheless, it should be close to "account everything" approach and
keep most workloads within bounds.  Malevolent users will be able to
breach the limit, but this was possible even with the former "account
everything" approach (simply because it did not account everything in
fact).

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-01-14 16:00:49 -08:00
..
accessibility
acpi libnvdimm for 4.5 2016-01-13 19:15:14 -08:00
amba
android
ata Merge branch 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2016-01-11 19:33:59 -08:00
atm
auxdisplay
base Power management and ACPI updates for v4.5-rc1 2016-01-12 20:25:09 -08:00
bcma
block SCSI misc on 20160113 2016-01-13 19:37:36 -08:00
bluetooth
bus
cdrom
char Some minor changes that have been in linux-next for a while. 2016-01-13 11:19:24 -08:00
clk
clocksource Merge branches 'timers-core-for-linus' and 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-01-11 18:06:43 -08:00
connector
cpufreq
cpuidle
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2016-01-12 18:51:14 -08:00
dca
devfreq
dio
dma dmaengine updates for 4.5-rc1 2016-01-13 10:59:52 -08:00
dma-buf
edac
eisa
extcon
firewire
firmware efi: include asm/early_ioremap.h not asm/efi.h to get early_memremap 2016-01-13 10:35:14 -08:00
fmc
fpga
gpio Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2016-01-13 11:14:05 -08:00
gpu Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2016-01-12 17:11:47 -08:00
hid
hsi
hv char/misc patches for 4.5-rc1 2016-01-13 10:23:36 -08:00
hwmon
hwspinlock
hwtracing
i2c Merge branch 'acpi-soc' 2016-01-12 01:08:47 +01:00
ide
idle
iio
infiniband
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2016-01-13 11:14:05 -08:00
iommu Merge branch 'x86-cleanups-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-01-11 16:26:03 -08:00
ipack
irqchip Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-01-11 18:28:06 -08:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-01-11 23:55:43 -05:00
leds
lguest
lightnvm
macintosh
mailbox
mcb
md libnvdimm for 4.5 2016-01-13 19:15:14 -08:00
media media updates for v4.5-rc1 2016-01-13 11:46:37 -08:00
memory
memstick
message
mfd Power management and ACPI updates for v4.5-rc1 2016-01-12 20:25:09 -08:00
misc
mmc
mtd MTD updates for v4.5: 2016-01-13 11:25:54 -08:00
net Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-01-12 18:57:02 -08:00
nfc
ntb
nubus
nvdimm
nvme
nvmem
of mdio: remove an unneed condition 2016-01-12 11:51:57 -05:00
oprofile
parisc
parport
pci Power management and ACPI updates for v4.5-rc1 2016-01-12 20:25:09 -08:00
pcmcia
perf
phy
pinctrl This is the bulk of pin control patches for the v4.5 2016-01-11 20:05:39 -08:00
platform
pnp
power
powercap Merge branch 'powercap' 2016-01-12 01:12:40 +01:00
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux 2016-01-13 13:16:16 -08:00
sbus
scsi SCSI misc on 20160113 2016-01-13 19:37:36 -08:00
sfi
sh
sn
soc
spi spi: Updates for v4.5 2016-01-13 11:38:27 -08:00
spmi
ssb
staging kmemcg: account certain kmem allocations to memcg 2016-01-14 16:00:49 -08:00
target
tc
thermal
thunderbolt
tty TTY/Serial patches for 4.5-rc1 2016-01-13 10:02:05 -08:00
uio
usb USB patches for 4.5-rc1 2016-01-13 09:26:40 -08:00
uwb
vfio
vhost
video
virt
virtio
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile