mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
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:
@@ -389,3 +389,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_freepages_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_freepages_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_thrashing_start);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_delayacct_thrashing_end);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_swap_page_spf);
|
||||
|
||||
@@ -174,6 +174,9 @@ DECLARE_HOOK(android_vh_isolate_freepages,
|
||||
DECLARE_HOOK(android_vh_ptep_clear_flush_young,
|
||||
TP_PROTO(bool *skip),
|
||||
TP_ARGS(skip));
|
||||
DECLARE_HOOK(android_vh_do_swap_page_spf,
|
||||
TP_PROTO(bool *allow_swap_spf),
|
||||
TP_ARGS(allow_swap_spf));
|
||||
#endif /* _TRACE_HOOK_MM_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
13
mm/memory.c
13
mm/memory.c
@@ -3720,12 +3720,17 @@ 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);
|
||||
count_vm_spf_event(SPF_ABORT_SWAP);
|
||||
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);
|
||||
count_vm_spf_event(SPF_ABORT_SWAP);
|
||||
return VM_FAULT_RETRY;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pte_unmap_same(vma->vm_mm, vmf->pmd, vmf->pte, vmf->orig_pte)) {
|
||||
|
||||
Reference in New Issue
Block a user