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:
@@ -514,6 +514,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_err_handler);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_err_check_ctrl);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ufs_err_print_ctrl);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vmscan_kswapd_done);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_swap_page_spf);
|
||||
/*
|
||||
* For type visibility
|
||||
*/
|
||||
|
@@ -362,6 +362,9 @@ DECLARE_HOOK(android_vh_madvise_cold_or_pageout_abort,
|
||||
DECLARE_HOOK(android_vh_skip_swapcache,
|
||||
TP_PROTO(swp_entry_t entry, bool *skip),
|
||||
TP_ARGS(entry, skip));
|
||||
DECLARE_HOOK(android_vh_do_swap_page_spf,
|
||||
TP_PROTO(bool *allow_swap_spf),
|
||||
TP_ARGS(allow_swap_spf));
|
||||
/* macro versions of hooks are no longer required */
|
||||
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
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