linux/arch/s390
Suren Baghdasaryan 46e714c729 arch/mm/fault: fix major fault accounting when retrying under per-VMA lock
A test [1] in Android test suite started failing after [2] was merged.  It
turns out that after handling a major fault under per-VMA lock, the
process major fault counter does not register that fault as major.  Before
[2] read faults would be done under mmap_lock, in which case
FAULT_FLAG_TRIED flag is set before retrying.  That in turn causes
mm_account_fault() to account the fault as major once retry completes. 
With per-VMA locks we often retry because a fault can't be handled without
locking the whole mm using mmap_lock.  Therefore such retries do not set
FAULT_FLAG_TRIED flag.  This logic does not work after [2] because we can
now handle read major faults under per-VMA lock and upon retry the fact
there was a major fault gets lost.  Fix this by setting FAULT_FLAG_TRIED
after retrying under per-VMA lock if VM_FAULT_MAJOR was returned.  Ideally
we would use an additional VM_FAULT bit to indicate the reason for the
retry (could not handle under per-VMA lock vs other reason) but this
simpler solution seems to work, so keeping it simple.

[1] https://cs.android.com/android/platform/superproject/+/master:test/vts-testcase/kernel/api/drop_caches_prop/drop_caches_test.cpp
[2] https://lore.kernel.org/all/20231006195318.4087158-6-willy@infradead.org/

Link: https://lkml.kernel.org/r/20231226214610.109282-1-surenb@google.com
Fixes: 12214eba19 ("mm: handle read faults under the VMA lock")
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-12-29 11:06:49 -08:00
..
appldata S390: Remove now superfluous sentinel elem from ctl_table arrays 2023-10-10 15:22:02 -07:00
boot s390/cmma: rework no-dat handling 2023-11-05 22:34:58 +01:00
configs s390: update defconfigs 2023-09-19 13:25:44 +02:00
crypto s390/paes: fix PKEY_TYPE_EP11_AES handling for secure keyblobs 2023-08-17 15:18:53 +02:00
hypfs hypfs: convert to new timestamp accessors 2023-10-18 13:26:15 +02:00
include s390: remove odd comment 2023-11-22 13:55:13 +01:00
kernel s390/ipl: add missing IPL_TYPE_ECKD_DUMP case to ipl_init() 2023-11-22 13:54:57 +01:00
kvm s390 updates for the 6.7 merge window 2023-11-03 10:17:22 -10:00
lib s390/ctlreg: add struct ctlreg 2023-09-19 13:26:56 +02:00
mm arch/mm/fault: fix major fault accounting when retrying under per-VMA lock 2023-12-29 11:06:49 -08:00
net bpf-next-for-netdev 2023-10-16 21:05:33 -07:00
pci IOMMU Updates for Linux v6.7 2023-11-09 13:37:28 -08:00
purgatory s390 updates for 6.5 merge window part 2 2023-07-06 13:18:30 -07:00
tools KVM: s390: Add facility 197 to the allow list 2022-07-13 15:25:25 +02:00
Kbuild - An extensive rework of kexec and crash Kconfig from Eric DeVolder 2023-08-29 14:53:51 -07:00
Kconfig kexec: fix KEXEC_FILE dependencies 2023-12-20 13:46:19 -08:00
Kconfig.debug s390/Kconfig.debug: fix indentation 2022-06-01 12:03:15 +02:00
Makefile kbuild: unify vdso_install rules 2023-10-28 21:09:02 +09:00