ANDROID: introduce a vendor hook to allow speculative swap pagefaults
Since SPF is an out-of-tree feature, the risks of changing its behavior are higher. Add a vendor hook to enable speculative swap pagefaults. By default it's disabled and should not cause troubles for current users. Bug: 322762567 Change-Id: I3df7c545aa27d2707ee51ea42368f785c5faa735 Signed-off-by: Suren Baghdasaryan <surenb@google.com>
This commit is contained in:
11
mm/memory.c
11
mm/memory.c
@@ -3623,11 +3623,16 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
|
||||
void *shadow = NULL;
|
||||
|
||||
if (vmf->flags & FAULT_FLAG_SPECULATIVE) {
|
||||
bool allow_swap_spf = false;
|
||||
|
||||
/* ksm_might_need_to_copy() needs a stable VMA, spf can't be used */
|
||||
#ifdef CONFIG_KSM
|
||||
pte_unmap(vmf->pte);
|
||||
return VM_FAULT_RETRY;
|
||||
#ifndef CONFIG_KSM
|
||||
trace_android_vh_do_swap_page_spf(&allow_swap_spf);
|
||||
#endif
|
||||
if (!allow_swap_spf) {
|
||||
pte_unmap(vmf->pte);
|
||||
return VM_FAULT_RETRY;
|
||||
}
|
||||
}
|
||||
|
||||
ret = pte_unmap_same(vmf);
|
||||
|
Reference in New Issue
Block a user