mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 04:12:04 -04:00
mm: don't do swap readahead during speculative page fault
Vinayak Menon faced a panic because one thread was page faulting a page in swap, while another one was mprotecting a part of the VMA leading to a VMA split. This raise a panic in swap_vma_readahead() because the VMA's boundaries were not more matching the faulting address. To avoid this, if the page is not found in the swap, the speculative page fault is aborted to retry a regular page fault. Change-Id: Ia9d99fb5fde7bd89f38966838d115b6c8c15c9db Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Patch-mainline: linux-mm @ Mon, 5 Nov 2018 18:43:01 +0100 [vinmenon@codeaurora.org: a minor 80+ line fix] Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
This commit is contained in:
parent
a9e3a1ab5d
commit
c41742ec7c
1 changed files with 11 additions and 0 deletions
11
mm/memory.c
11
mm/memory.c
|
|
@ -2995,6 +2995,17 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
|||
lru_cache_add_anon(page);
|
||||
swap_readpage(page, true);
|
||||
}
|
||||
} else if (vmf->flags & FAULT_FLAG_SPECULATIVE) {
|
||||
/*
|
||||
* Don't try readahead during a speculative page fault
|
||||
* as the VMA's boundaries may change in our back.
|
||||
* If the page is not in the swap cache and synchronous
|
||||
* read is disabled, fall back to the regular page fault
|
||||
* mechanism.
|
||||
*/
|
||||
delayacct_clear_flag(DELAYACCT_PF_SWAPIN);
|
||||
ret = VM_FAULT_RETRY;
|
||||
goto out;
|
||||
} else {
|
||||
page = swapin_readahead(entry, GFP_HIGHUSER_MOVABLE,
|
||||
vmf);
|
||||
|
|
|
|||
Loading…
Reference in a new issue