android_kernel_msm-6.1_noth.../include
Suren Baghdasaryan d73ebe031c UPSTREAM: mm/khugepaged: write-lock VMA while collapsing a huge page
Protect VMA from concurrent page fault handler while collapsing a huge
page.  Page fault handler needs a stable PMD to use PTL and relies on
per-VMA lock to prevent concurrent PMD changes.  pmdp_collapse_flush(),
set_huge_pmd() and collapse_and_free_pmd() can modify a PMD, which will
not be detected by a page fault handler without proper locking.

Before this patch, page tables can be walked under any one of the
mmap_lock, the mapping lock, and the anon_vma lock; so when khugepaged
unlinks and frees page tables, it must ensure that all of those either are
locked or don't exist.  This patch adds a fourth lock under which page
tables can be traversed, and so khugepaged must also lock out that one.

[surenb@google.com: vm_lock/i_mmap_rwsem inversion in retract_page_tables]
  Link: https://lkml.kernel.org/r/20230303213250.3555716-1-surenb@google.com
[surenb@google.com: build fix]
  Link: https://lkml.kernel.org/r/CAJuCfpFjWhtzRE1X=J+_JjgJzNKhq-=JT8yTBSTHthwp0pqWZw@mail.gmail.com
Link: https://lkml.kernel.org/r/20230227173632.3292573-16-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

(cherry picked from commit 55fd6fccad3172c0feaaa817f0a1283629ff183e)

Bug: 161210518
Change-Id: I6c3cddd7861dd03fe496c4de20f284dc692c8654
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
2023-06-07 14:24:59 +00:00
..
acpi ACPI: video: Add auto_detect arg to __acpi_video_get_backlight_type() 2023-04-13 16:55:33 +02:00
asm-generic BACKPORT: arm64: unwind: add asynchronous unwind tables to kernel and modules 2023-05-25 15:37:14 -07:00
clocksource
crypto
drm Merge 6.1.24 into android14-6.1 2023-04-22 08:52:25 +00:00
dt-bindings dt-bindings: clocks: imx8mp: Add ID for usb suspend clock 2022-12-31 13:33:09 +01:00
keys
kunit kunit: fix kunit_test_init_section_suites(...) 2023-02-09 11:28:08 +01:00
kvm Revert "Revert "KVM: arm64: PMU: Align chained counter implementation with architecture pseudocode"" 2023-05-11 05:22:29 +00:00
linux UPSTREAM: mm/khugepaged: write-lock VMA while collapsing a huge page 2023-06-07 14:24:59 +00:00
math-emu
media ANDROID: GKI: add kabi padding for structures for the android14 release 2023-06-07 14:24:51 +00:00
memory memory: renesas-rpc-if: Split-off private data from struct rpcif 2023-03-11 13:55:17 +01:00
misc
net ANDROID: GKI: sock.h: add Android ABI padding to some structures 2023-06-07 14:24:55 +00:00
pcmcia
ras
rdma
rv
scsi ANDROID: GKI: scsi: add Android ABI padding to some structures 2023-06-07 14:24:56 +00:00
soc ARM: at91: pm: avoid soft resetting AC DLL 2022-11-01 12:25:19 +02:00
sound ANDROID: GKI: add kabi padding for structures for the android14 release 2023-06-07 14:24:51 +00:00
target
trace ANDROID: vendor_hooks: add hooks for extra memory 2023-06-07 01:06:25 +00:00
uapi UPSTREAM: ipv{4,6}/raw: fix output xfrm lookup wrt protocol 2023-06-07 14:24:50 +00:00
ufs ANDROID: GKI: add kabi padding for structures for the android14 release 2023-06-07 14:24:51 +00:00
vdso
video
xen x86/PVH: obtain VGA console info in Dom0 2023-04-06 12:10:39 +02:00
OWNERS