linux-stable/drivers
Peter Xu bce617edec mm: do page fault accounting in handle_mm_fault
Patch series "mm: Page fault accounting cleanups", v5.

This is v5 of the pf accounting cleanup series.  It originates from Gerald
Schaefer's report on an issue a week ago regarding to incorrect page fault
accountings for retried page fault after commit 4064b98270 ("mm: allow
VM_FAULT_RETRY for multiple times"):

  https://lore.kernel.org/lkml/20200610174811.44b94525@thinkpad/

What this series did:

  - Correct page fault accounting: we do accounting for a page fault
    (no matter whether it's from #PF handling, or gup, or anything else)
    only with the one that completed the fault.  For example, page fault
    retries should not be counted in page fault counters.  Same to the
    perf events.

  - Unify definition of PERF_COUNT_SW_PAGE_FAULTS: currently this perf
    event is used in an adhoc way across different archs.

    Case (1): for many archs it's done at the entry of a page fault
    handler, so that it will also cover e.g.  errornous faults.

    Case (2): for some other archs, it is only accounted when the page
    fault is resolved successfully.

    Case (3): there're still quite some archs that have not enabled
    this perf event.

    Since this series will touch merely all the archs, we unify this
    perf event to always follow case (1), which is the one that makes most
    sense.  And since we moved the accounting into handle_mm_fault, the
    other two MAJ/MIN perf events are well taken care of naturally.

  - Unify definition of "major faults": the definition of "major
    fault" is slightly changed when used in accounting (not
    VM_FAULT_MAJOR).  More information in patch 1.

  - Always account the page fault onto the one that triggered the page
    fault.  This does not matter much for #PF handlings, but mostly for
    gup.  More information on this in patch 25.

Patchset layout:

Patch 1:     Introduced the accounting in handle_mm_fault(), not enabled.
Patch 2-23:  Enable the new accounting for arch #PF handlers one by one.
Patch 24:    Enable the new accounting for the rest outliers (gup, iommu, etc.)
Patch 25:    Cleanup GUP task_struct pointer since it's not needed any more

This patch (of 25):

This is a preparation patch to move page fault accountings into the
general code in handle_mm_fault().  This includes both the per task
flt_maj/flt_min counters, and the major/minor page fault perf events.  To
do this, the pt_regs pointer is passed into handle_mm_fault().

PERF_COUNT_SW_PAGE_FAULTS should still be kept in per-arch page fault
handlers.

So far, all the pt_regs pointer that passed into handle_mm_fault() is
NULL, which means this patch should have no intented functional change.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Cain <bcain@codeaurora.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Guo Ren <guoren@kernel.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Helge Deller <deller@gmx.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Nick Hu <nickhu@andestech.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Rich Felker <dalias@libc.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Stafford Horne <shorne@gmail.com>
Cc: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Will Deacon <will@kernel.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Link: http://lkml.kernel.org/r/20200707225021.200906-1-peterx@redhat.com
Link: http://lkml.kernel.org/r/20200707225021.200906-2-peterx@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-08-12 10:58:02 -07:00
..
accessibility TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
acpi - Add support to enable/disable the thermal zones resulting on core code and 2020-08-06 18:10:55 -07:00
amba
android drivers: android: Fix the SPDX comment style 2020-07-29 17:05:44 +02:00
ata
atm Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
auxdisplay Minor cleanup for auxdisplay: 2020-08-06 18:09:34 -07:00
base More power management updates for 5.9-rc1 2020-08-07 13:13:09 -07:00
bcma bcma: gpio: Use irqchip template 2020-08-02 18:26:51 +03:00
block pci-v5.9-changes 2020-08-07 18:48:15 -07:00
bluetooth Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next 2020-07-31 15:11:52 -07:00
bus MIPS upates for v5.9 2020-08-06 10:54:07 -07:00
cdrom
char Minor cleanups to the IPMI driver for 5.9 2020-08-08 09:32:18 -07:00
clk It looks like a smaller batch of clk updates this time around. In the core 2020-08-07 13:35:51 -07:00
clocksource Time, timers and related driver updates: 2020-08-04 18:17:37 -07:00
connector
counter
cpufreq Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-08-04 12:44:53 +02:00
cpuidle powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
crypto Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
dax
dca
devfreq PM / devfreq: Fix the wrong end with semicolon 2020-07-30 17:22:58 +09:00
dio
dma Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
dma-buf A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
edac 17ed808ad2 ("EDAC: Fix reference count leaks") 2020-08-03 20:01:00 -07:00
eisa
extcon
firewire
firmware uaccess: add force_uaccess_{begin,end} helpers 2020-08-12 10:57:59 -07:00
fpga Linux 5.8-rc7 2020-07-27 11:49:37 +02:00
fsi
gnss
gpio This is the bulk of GPIO changes for the v5.9 kernel cycle: 2020-08-05 12:56:27 -07:00
gpu A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
greybus greybus: Use fallthrough pseudo-keyword 2020-07-29 16:58:08 +02:00
hid Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid 2020-08-10 16:33:54 -07:00
hsi
hv hyperv-next for 5.9 2020-08-06 09:26:10 -07:00
hwmon hwmon updates for v5.9 2020-08-05 13:13:57 -07:00
hwspinlock
hwtracing
i2c Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
i3c
ide
idle Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
iio
infiniband RDMA 5.9 merge window pull request 2020-08-06 16:43:36 -07:00
input Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2020-08-10 16:35:57 -07:00
interconnect Char/Misc driver patches for 5.9-rc1 2020-08-05 11:43:47 -07:00
iommu mm: do page fault accounting in handle_mm_fault 2020-08-12 10:58:02 -07:00
ipack
irqchip The usual boring updates from the interrupt subsystem: 2020-08-04 18:11:58 -07:00
isdn mISDN: Don't try to print a sockptr_t from debug logging code. 2020-07-24 16:36:13 -07:00
leds LEDs changes for 5.9-rc1. 2020-08-05 19:24:27 -07:00
lightnvm
macintosh powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
mailbox mailbox: mediatek: cmdq: clear task in channel before shutdown 2020-08-03 23:56:38 -05:00
mcb
md A set of locking fixes and updates: 2020-08-10 19:07:44 -07:00
media pci-v5.9-changes 2020-08-07 18:48:15 -07:00
memory MTD core changes: 2020-08-09 12:38:51 -07:00
memstick MMC core: 2020-08-05 13:23:24 -07:00
message
mfd
misc Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
mmc This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
most drivers: most: add USB adapter driver 2020-07-31 14:38:12 +02:00
mtd This pull request contains changes for JFFS2, UBI and UBIFS 2020-08-10 18:20:04 -07:00
mux
net pci-v5.9-changes 2020-08-07 18:48:15 -07:00
nfc
ntb
nubus
nvdimm powerpc updates for 5.9 2020-08-07 10:33:50 -07:00
nvme for-5.9/block-merge-20200804 2020-08-05 11:12:34 -07:00
nvmem nvmem: qcom-spmi-sdam: Enable multiple devices 2020-07-29 17:12:09 +02:00
of MIPS upates for v5.9 2020-08-06 10:54:07 -07:00
opp Merge branch 'cpufreq/arm/linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/vireshk/pm 2020-08-04 12:44:53 +02:00
oprofile
parisc
parport
pci pci-v5.9-changes 2020-08-07 18:48:15 -07:00
pcmcia
perf It looks like a smaller batch of clk updates this time around. In the core 2020-08-07 13:35:51 -07:00
phy phy for 5.9 2020-07-23 09:52:10 +02:00
pinctrl This is the bulk of the pin control changes for the v5.9 2020-08-09 12:52:28 -07:00
platform - Add support to enable/disable the thermal zones resulting on core code and 2020-08-06 18:10:55 -07:00
pnp
power power supply and reset changes for the v5.9 series 2020-08-07 21:27:37 -07:00
powercap This tree adds the sched_set_fifo*() encapsulation APIs to remove 2020-08-06 11:55:43 -07:00
pps
ps3
ptp ptp: only allow phase values lower than 1 period 2020-08-05 12:06:44 -07:00
pwm
rapidio rapidio/rio_mport_cdev: use array_size() helper in copy_{from,to}_user() 2020-08-12 10:58:01 -07:00
ras
regulator Merge remote-tracking branch 'regulator/for-5.9' into regulator-next 2020-07-30 23:27:08 +01:00
remoteproc
reset SOC: TI Keystone driver update for v5.9 2020-07-27 14:24:51 +02:00
rpmsg
rtc
s390 Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
sbus
scsi pci-v5.9-changes 2020-08-07 18:48:15 -07:00
sfi
sh
siox
slimbus
soc Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2020-08-07 21:14:30 -07:00
soundwire soundwire updates for 5.9-rc1 2020-07-23 09:12:15 +02:00
spi sound updates for 5.9 2020-08-06 14:27:31 -07:00
spmi
ssb Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-08-05 20:13:21 -07:00
staging pci-v5.9-changes 2020-08-07 18:48:15 -07:00
target Merge branch 'akpm' (patches from Andrew) 2020-08-07 11:39:33 -07:00
tc
tee
thermal thermal: don't make THERMAL_NETLINK 'default y' 2020-08-07 09:05:02 -07:00
thunderbolt thunderbolt: merge fix for kunix_resource changes 2020-08-09 11:06:10 -07:00
tty TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
uio
usb media updates for v5.9-rc1 2020-08-07 13:00:53 -07:00
vdpa
vfio
vhost Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
video TTY/Serial patches for 5.9-rc1 2020-08-06 14:56:11 -07:00
virt
virtio Remove uninitialized_var() macro for v5.9-rc1 2020-08-04 13:49:43 -07:00
visorbus
vlynq
vme
w1
watchdog
xen Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
zorro
Kconfig
Makefile