mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/
synced 2026-10-12 06:01:58 +00:00
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:
|
History
|
|
|---|---|---|
| .. | ||
| book3s32 | ||
| book3s64 | ||
| kasan | ||
| nohash | ||
| ptdump | ||
| cacheflush.c | ||
| copro_fault.c | ||
| dma-noncoherent.c | ||
| drmem.c | ||
| fault.c | ||
| hugetlbpage.c | ||
| init-common.c | ||
| init_32.c | ||
| init_64.c | ||
| ioremap.c | ||
| ioremap_32.c | ||
| ioremap_64.c | ||
| maccess.c | ||
| Makefile | ||
| mem.c | ||
| mmu_context.c | ||
| mmu_decl.h | ||
| numa.c | ||
| pageattr.c | ||
| pgtable-frag.c | ||
| pgtable.c | ||
| pgtable_32.c | ||
| pgtable_64.c | ||