mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
BACKPORT: FROMLIST: mm: add do_handle_mm_fault()
Add a new do_handle_mm_fault function, which extends the existing handle_mm_fault() API by adding an mmap sequence count, to be used in the FAULT_FLAG_SPECULATIVE case. In the initial implementation, FAULT_FLAG_SPECULATIVE always fails (by returning VM_FAULT_RETRY). The existing handle_mm_fault() API is kept as a wrapper around do_handle_mm_fault() so that we do not have to immediately update every handle_mm_fault() call site. Signed-off-by: Michel Lespinasse <michel@lespinasse.org> Conflicts: mm/memory.c 1. Trivial merge conflict due to folios. Link: https://lore.kernel.org/all/20220128131006.67712-10-michel@lespinasse.org/ Bug: 161210518 Signed-off-by: Suren Baghdasaryan <surenb@google.com> Change-Id: Ic07b6d84af3e5d1fcc856e0968f1a6dd1544fa88
This commit is contained in:
committed by
Todd Kjos
parent
f2fa9aae2e
commit
4e2e391ff7
@@ -1776,9 +1776,15 @@ int generic_error_remove_page(struct address_space *mapping, struct page *page);
|
||||
int invalidate_inode_page(struct page *page);
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned int flags,
|
||||
struct pt_regs *regs);
|
||||
extern vm_fault_t do_handle_mm_fault(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned int flags,
|
||||
unsigned long seq, struct pt_regs *regs);
|
||||
static inline vm_fault_t handle_mm_fault(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned int flags,
|
||||
struct pt_regs *regs)
|
||||
{
|
||||
return do_handle_mm_fault(vma, address, flags, 0, regs);
|
||||
}
|
||||
extern int fixup_user_fault(struct mm_struct *mm,
|
||||
unsigned long address, unsigned int fault_flags,
|
||||
bool *unlocked);
|
||||
|
||||
10
mm/memory.c
10
mm/memory.c
@@ -4763,11 +4763,15 @@ static inline void mm_account_fault(struct pt_regs *regs,
|
||||
* The mmap_lock may have been released depending on flags and our
|
||||
* return value. See filemap_fault() and __lock_page_or_retry().
|
||||
*/
|
||||
vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
|
||||
unsigned int flags, struct pt_regs *regs)
|
||||
vm_fault_t do_handle_mm_fault(struct vm_area_struct *vma,
|
||||
unsigned long address, unsigned int flags,
|
||||
unsigned long seq, struct pt_regs *regs)
|
||||
{
|
||||
vm_fault_t ret;
|
||||
|
||||
if (flags & FAULT_FLAG_SPECULATIVE)
|
||||
return VM_FAULT_RETRY;
|
||||
|
||||
__set_current_state(TASK_RUNNING);
|
||||
|
||||
count_vm_event(PGFAULT);
|
||||
@@ -4809,7 +4813,7 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(handle_mm_fault);
|
||||
EXPORT_SYMBOL_GPL(do_handle_mm_fault);
|
||||
|
||||
#ifndef __PAGETABLE_P4D_FOLDED
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user