linux/drivers
David Rientjes 5ff7091f5a mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks
Commit 4d4bbd8526 ("mm, oom_reaper: skip mm structs with mmu
notifiers") prevented the oom reaper from unmapping private anonymous
memory with the oom reaper when the oom victim mm had mmu notifiers
registered.

The rationale is that doing mmu_notifier_invalidate_range_{start,end}()
around the unmap_page_range(), which is needed, can block and the oom
killer will stall forever waiting for the victim to exit, which may not
be possible without reaping.

That concern is real, but only true for mmu notifiers that have
blockable invalidate_range_{start,end}() callbacks.  This patch adds a
"flags" field to mmu notifier ops that can set a bit to indicate that
these callbacks do not block.

The implementation is steered toward an expensive slowpath, such as
after the oom reaper has grabbed mm->mmap_sem of a still alive oom
victim.

[rientjes@google.com: mmu_notifier_invalidate_range_end() can also call the invalidate_range() must not block, fix comment]
  Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1801091339570.240101@chino.kir.corp.google.com
[akpm@linux-foundation.org: make mm_has_blockable_invalidate_notifiers() return bool, use rwsem_is_locked()]
Link: http://lkml.kernel.org/r/alpine.DEB.2.10.1712141329500.74052@chino.kir.corp.google.com
Signed-off-by: David Rientjes <rientjes@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Dimitri Sivanich <sivanich@hpe.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Oded Gabbay <oded.gabbay@gmail.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: David Airlie <airlied@linux.ie>
Cc: Joerg Roedel <joro@8bytes.org>
Cc: Doug Ledford <dledford@redhat.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
Cc: Sean Hefty <sean.hefty@intel.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Jérôme Glisse <jglisse@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-01-31 17:18:38 -08:00
..
accessibility
acpi DMAengine updates for v4.16-rc1 2018-01-31 11:52:20 -08:00
amba
android Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
ata Merge branch 'for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2018-01-30 14:48:30 -08:00
atm
auxdisplay
base DMAengine updates for v4.16-rc1 2018-01-31 11:52:20 -08:00
bcma bcma: Fix 'allmodconfig' and BCMA builds on MIPS targets 2018-01-16 21:13:55 +02:00
block Merge branch 'work.sock_recvmsg' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 18:59:03 -08:00
bluetooth
bus Merge branches 'pm-domains', 'pm-kconfig', 'pm-cpuidle' and 'powercap' 2018-01-18 02:54:45 +01:00
cdrom
char Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
clk
clocksource
connector
cpufreq Merge branch 'pm-cpufreq-thermal' into pm-cpufreq 2018-01-18 02:52:42 +01:00
cpuidle
crypto dma-mapping: move swiotlb arch helpers to a new header 2018-01-10 16:40:54 +01:00
dax
dca
devfreq
dio
dma DMAengine updates for v4.16-rc1 2018-01-31 11:52:20 -08:00
dma-buf
edac
eisa
extcon
firewire
firmware arm64 updates for 4.16: 2018-01-30 13:57:43 -08:00
fmc
fpga
fsi
gpio Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
gpu Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
hid Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
hsi
hv Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
hwmon hwmon: (dell-smm) Disable fan support for Dell Vostro 3360 2018-01-27 09:34:22 -08:00
hwspinlock
hwtracing arm64 updates for 4.16: 2018-01-30 13:57:43 -08:00
i2c Power management updates for v4.16-rc1 2018-01-29 09:47:41 -08:00
ide
idle
iio Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
infiniband mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks 2018-01-31 17:18:38 -08:00
input Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
iommu mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks 2018-01-31 17:18:38 -08:00
ipack
irqchip arm64 updates for 4.16: 2018-01-30 13:57:43 -08:00
isdn Merge branch 'work.sock_recvmsg' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 18:59:03 -08:00
leds Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
lightnvm
macintosh
mailbox
mcb
md - DM core fixes to ensure that bio submission follows a depth-first tree 2018-01-31 11:05:47 -08:00
media Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
memory mtd: onenand: omap2: Configure driver from DT 2018-01-12 16:41:15 +01:00
memstick
message scsi: mptsas: remove duplicated assignment to pointer head 2018-01-17 01:19:38 -05:00
mfd regmap: Updates for v4.16 2018-01-29 11:35:24 -08:00
misc mm, mmu_notifier: annotate mmu notifiers with blockable invalidate callbacks 2018-01-31 17:18:38 -08:00
mmc There are two major achievements for MMC in this release, which deserves to be 2018-01-29 11:26:11 -08:00
mtd dma mapping changes for Linux 4.16: 2018-01-31 11:32:27 -08:00
mux
net First merge window pull request for 4.16 2018-01-31 12:05:10 -08:00
nfc
ntb
nubus nubus: Add support for the driver model 2018-01-16 16:47:29 +01:00
nvdimm
nvme Merge branch 'for-4.16/block' of git://git.kernel.dk/linux-block 2018-01-29 11:51:49 -08:00
nvmem
of DMAengine updates for v4.16-rc1 2018-01-31 11:52:20 -08:00
opp
oprofile
parisc
parport
pci Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
pcmcia
perf perf: dsu: Use signed field for dsu_pmu->num_counters 2018-01-15 18:02:17 +00:00
phy Merge branch 'for-4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2018-01-30 14:48:30 -08:00
pinctrl
platform Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
pnp
power
powercap powercap: intel_rapl: Fix trailing semicolon 2018-01-17 12:56:24 +01:00
pps
ps3
ptp
pwm
rapidio
ras mm/memory_failure: Remove unused trapno from memory_failure 2018-01-23 12:17:42 -06:00
regulator Merge remote-tracking branch 'regulator/topic/tps65218' into regulator-next 2018-01-26 17:57:05 +00:00
remoteproc
reset
rpmsg
rtc
s390 Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
sbus
scsi SCSI misc on 20180131 2018-01-31 11:23:28 -08:00
sfi
sh
sn
soc
spi Merge remote-tracking branch 'spi/topic/xilinx' into spi-next 2018-01-26 17:57:34 +00:00
spmi
ssb ssb: Disable PCI host for PCI_DRIVERS_GENERIC 2018-01-16 21:15:58 +02:00
staging Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
target Merge branch 'for-4.16/block' of git://git.kernel.dk/linux-block 2018-01-29 11:51:49 -08:00
tc
tee
thermal
thunderbolt
tty Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
uio
usb Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
uwb
vfio
vhost Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
video m68k updates for 4.16 2018-01-29 16:37:15 -08:00
virt
virtio
vlynq
vme
w1
watchdog
xen dma mapping changes for Linux 4.16: 2018-01-31 11:32:27 -08:00
zorro
Kconfig
Makefile