https://github.com/torvalds/linux
Revision 9ef0f88fe5466c2ca1d2975549ba6be502c464c1 authored by John David Anglin on 07 March 2018, 13:18:05 UTC, committed by Helge Deller on 17 March 2018, 10:49:39 UTC
Just when I had decided that flush_cache_range() was always called with
a valid context, Helge reported two cases where the
"BUG_ON(!vma->vm_mm->context);" was hit on the phantom buildd:

 kernel BUG at /mnt/sdb6/linux/linux-4.15.4/arch/parisc/kernel/cache.c:587!
 CPU: 1 PID: 3254 Comm: kworker/1:2 Tainted: G D 4.15.0-1-parisc64-smp #1 Debian 4.15.4-1+b1
 Workqueue: events free_ioctx
  IAOQ[0]: flush_cache_range+0x164/0x168
  IAOQ[1]: flush_cache_page+0x0/0x1c8
  RP(r2): unmap_page_range+0xae8/0xb88
 Backtrace:
  [<00000000404a6980>] unmap_page_range+0xae8/0xb88
  [<00000000404a6ae0>] unmap_single_vma+0xc0/0x188
  [<00000000404a6cdc>] zap_page_range_single+0x134/0x1f8
  [<00000000404a702c>] unmap_mapping_range+0x1cc/0x208
  [<0000000040461518>] truncate_pagecache+0x98/0x108
  [<0000000040461624>] truncate_setsize+0x9c/0xb8
  [<00000000405d7f30>] put_aio_ring_file+0x80/0x100
  [<00000000405d803c>] aio_free_ring+0x8c/0x290
  [<00000000405d82c0>] free_ioctx+0x80/0x180
  [<0000000040284e6c>] process_one_work+0x21c/0x668
  [<00000000402854c4>] worker_thread+0x20c/0x778
  [<0000000040291d44>] kthread+0x2d4/0x2e0
  [<0000000040204020>] end_fault_vector+0x20/0xc0

This indicates that we need to handle the no context case in
flush_cache_range() as we do in flush_cache_mm().

In thinking about this, I realized that we don't need to flush the TLB
when there is no context.  So, I added context checks to the large flush
cases in flush_cache_mm() and flush_cache_range().  The large flush case
occurs frequently in flush_cache_mm() and the change should improve fork
performance.

The v2 version of this change removes the BUG_ON from flush_cache_page()
by skipping the TLB flush when there is no context.  I also added code
to flush the TLB in flush_cache_mm() and flush_cache_range() when we
have a context that's not current.  Now all three routines handle TLB
flushes in a similar manner.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
Cc: stable@vger.kernel.org # 4.9+
Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 8f5fd92
History
Tip revision: 9ef0f88fe5466c2ca1d2975549ba6be502c464c1 authored by John David Anglin on 07 March 2018, 13:18:05 UTC
parisc: Handle case where flush_cache_range is called with no context
Tip revision: 9ef0f88
File Mode Size
ABI
EDID
PCI
RCU
accelerators
accounting
acpi
admin-guide
aoe
arm
arm64
auxdisplay
backlight
blackfin
block
blockdev
bpf
bus-devices
cdrom
cgroup-v1
cma
connector
console
core-api
cpu-freq
cpuidle
cris
crypto
dev-tools
device-mapper
devicetree
doc-guide
driver-api
driver-model
early-userspace
extcon
fault-injection
fb
features
filesystems
firmware_class
fmc
fpga
frv
gpio
gpu
hid
hwmon
i2c
ia64
ide
iio
infiniband
input
ioctl
isdn
kbuild
kdump
kernel-hacking
laptops
leds
lightnvm
livepatch
locking
m68k
maintainer
md
media
memory-devices
metag
mic
mips
misc-devices
mmc
mn10300
mtd
namespaces
netlabel
networking
nfc
nios2
nvdimm
nvmem
openrisc
parisc
pcmcia
perf
phy
platform
power
powerpc
pps
process
pti
ptp
rapidio
s390
scheduler
scsi
security
serial
sh
sound
sparc
sphinx
sphinx-static
spi
sysctl
target
thermal
timers
trace
translations
usb
userspace-api
virtual
vm
w1
watchdog
wimax
x86
xtensa
.gitignore -rw-r--r-- 13 bytes
00-INDEX -rw-r--r-- 14.8 KB
Changes l--------- 19 bytes
CodingStyle -rw-r--r-- 48 bytes
DMA-API-HOWTO.txt -rw-r--r-- 34.1 KB
DMA-API.txt -rw-r--r-- 27.6 KB
DMA-ISA-LPC.txt -rw-r--r-- 5.1 KB
DMA-attributes.txt -rw-r--r-- 6.9 KB
IPMI.txt -rw-r--r-- 29.7 KB
IRQ-affinity.txt -rw-r--r-- 2.5 KB
IRQ-domain.txt -rw-r--r-- 10.9 KB
IRQ.txt -rw-r--r-- 994 bytes
Intel-IOMMU.txt -rw-r--r-- 3.9 KB
Makefile -rw-r--r-- 4.5 KB
SAK.txt -rw-r--r-- 3.0 KB
SM501.txt -rw-r--r-- 2.8 KB
SubmittingPatches -rw-r--r-- 54 bytes
atomic_bitops.txt -rw-r--r-- 1.5 KB
atomic_t.txt -rw-r--r-- 5.5 KB
bcache.txt -rw-r--r-- 23.7 KB
bt8xxgpio.txt -rw-r--r-- 4.0 KB
btmrvl.txt -rw-r--r-- 2.7 KB
bus-virt-phys-mapping.txt -rw-r--r-- 8.0 KB
cachetlb.txt -rw-r--r-- 17.2 KB
cgroup-v2.txt -rw-r--r-- 72.6 KB
circular-buffers.txt -rw-r--r-- 8.2 KB
clearing-warn-once.txt -rw-r--r-- 224 bytes
clk.txt -rw-r--r-- 11.6 KB
conf.py -rw-r--r-- 19.0 KB
cpu-load.txt -rw-r--r-- 3.0 KB
cputopology.txt -rw-r--r-- 5.6 KB
crc32.txt -rw-r--r-- 8.6 KB
dcdbas.txt -rw-r--r-- 3.9 KB
debugging-modules.txt -rw-r--r-- 954 bytes
debugging-via-ohci1394.txt -rw-r--r-- 7.5 KB
dell_rbu.txt -rw-r--r-- 5.1 KB
digsig.txt -rw-r--r-- 3.0 KB
docutils.conf -rw-r--r-- 158 bytes
dontdiff -rw-r--r-- 2.5 KB
efi-stub.txt -rw-r--r-- 3.3 KB
eisa.txt -rw-r--r-- 7.6 KB
flexible-arrays.txt -rw-r--r-- 5.6 KB
futex-requeue-pi.txt -rw-r--r-- 5.1 KB
gcc-plugins.txt -rw-r--r-- 2.9 KB
highuid.txt -rw-r--r-- 2.6 KB
hw_random.txt -rw-r--r-- 3.8 KB
hwspinlock.txt -rw-r--r-- 12.5 KB
index.rst -rw-r--r-- 3.0 KB
intel_txt.txt -rw-r--r-- 10.3 KB
io-mapping.txt -rw-r--r-- 3.3 KB
io_ordering.txt -rw-r--r-- 2.0 KB
iostats.txt -rw-r--r-- 8.1 KB
irqflags-tracing.txt -rw-r--r-- 2.3 KB
isa.txt -rw-r--r-- 5.1 KB
isapnp.txt -rw-r--r-- 492 bytes
kernel-per-CPU-kthreads.txt -rw-r--r-- 13.3 KB
kobject.txt -rw-r--r-- 18.3 KB
kprobes.txt -rw-r--r-- 29.4 KB
kref.txt -rw-r--r-- 8.9 KB
ldm.txt -rw-r--r-- 4.6 KB
lockup-watchdogs.txt -rw-r--r-- 4.1 KB
logo.gif -rw-r--r-- 16.0 KB
logo.txt -rw-r--r-- 563 bytes
lsm.txt -rw-r--r-- 10.5 KB
lzo.txt -rw-r--r-- 7.9 KB
mailbox.txt -rw-r--r-- 4.4 KB
memory-barriers.txt -rw-r--r-- 113.0 KB
memory-hotplug.txt -rw-r--r-- 18.6 KB
men-chameleon-bus.txt -rw-r--r-- 5.7 KB
nommu-mmap.txt -rw-r--r-- 12.4 KB
ntb.txt -rw-r--r-- 10.8 KB
numastat.txt -rw-r--r-- 1.0 KB
padata.txt -rw-r--r-- 7.4 KB
parport-lowlevel.txt -rw-r--r-- 37.1 KB
percpu-rw-semaphore.txt -rw-r--r-- 1.1 KB
phy.txt -rw-r--r-- 7.8 KB
pi-futex.txt -rw-r--r-- 5.7 KB
pnp.txt -rw-r--r-- 7.0 KB
preempt-locking.txt -rw-r--r-- 5.6 KB
pwm.txt -rw-r--r-- 6.2 KB
rbtree.txt -rw-r--r-- 14.8 KB
remoteproc.txt -rw-r--r-- 12.6 KB
rfkill.txt -rw-r--r-- 5.0 KB
robust-futex-ABI.txt -rw-r--r-- 8.7 KB
robust-futexes.txt -rw-r--r-- 9.5 KB
rpmsg.txt -rw-r--r-- 13.1 KB
rtc.txt -rw-r--r-- 7.0 KB
sgi-ioc4.txt -rw-r--r-- 2.1 KB
siphash.txt -rw-r--r-- 6.3 KB
smsc_ece1099.txt -rw-r--r-- 2.5 KB
speculation.txt -rw-r--r-- 2.8 KB
static-keys.txt -rw-r--r-- 13.0 KB
svga.txt -rw-r--r-- 11.8 KB
switchtec.txt -rw-r--r-- 3.6 KB
sync_file.txt -rw-r--r-- 3.1 KB
tee.txt -rw-r--r-- 5.2 KB
this_cpu_ops.txt -rw-r--r-- 11.2 KB
unaligned-memory-access.txt -rw-r--r-- 10.4 KB
vfio-mediated-device.txt -rw-r--r-- 14.3 KB
vfio.txt -rw-r--r-- 21.3 KB
video-output.txt -rw-r--r-- 1.1 KB
xillybus.txt -rw-r--r-- 17.6 KB
xz.txt -rw-r--r-- 5.5 KB
zorro.txt -rw-r--r-- 2.9 KB

back to top