BACKPORT: FROMGIT: mm: Pass 'address' to map to do_set_pte() and drop FAULT_FLAG_PREFAULT
Rather than modifying the 'address' field of the 'struct vm_fault' passed to do_set_pte(), leave that to identify the real faulting address and pass in the virtual address to be mapped by the new pte as a separate argument. This makes FAULT_FLAG_PREFAULT redundant, as a prefault entry can be identified simply by comparing the new address parameter with the faulting address, so remove the redundant flag at the same time. Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Will Deacon <will@kernel.org> Change-Id: I495c06047bac0f4e2241bc47a18b8ee8f97e4af8 Bug: 171278850 (cherry picked from commit 9d3af4b448a119ac81378d3bc775f1c4a2a7ff36 https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/faultaround) [vinmenon: changes for speculative page fault] Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
This commit is contained in:
10
mm/memory.c
10
mm/memory.c
@@ -3952,11 +3952,11 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page)
|
||||
}
|
||||
#endif
|
||||
|
||||
void do_set_pte(struct vm_fault *vmf, struct page *page)
|
||||
void do_set_pte(struct vm_fault *vmf, struct page *page, unsigned long addr)
|
||||
{
|
||||
struct vm_area_struct *vma = vmf->vma;
|
||||
bool write = vmf->flags & FAULT_FLAG_WRITE;
|
||||
bool prefault = vmf->flags & FAULT_FLAG_PREFAULT;
|
||||
bool prefault = vmf->address != addr;
|
||||
pte_t entry;
|
||||
|
||||
flush_icache_page(vma, page);
|
||||
@@ -3972,13 +3972,13 @@ void do_set_pte(struct vm_fault *vmf, struct page *page)
|
||||
/* copy-on-write page */
|
||||
if (write && !(vmf->vma_flags & VM_SHARED)) {
|
||||
inc_mm_counter_fast(vma->vm_mm, MM_ANONPAGES);
|
||||
__page_add_new_anon_rmap(page, vma, vmf->address, false);
|
||||
__page_add_new_anon_rmap(page, vma, addr, false);
|
||||
__lru_cache_add_inactive_or_unevictable(page, vmf->vma_flags);
|
||||
} else {
|
||||
inc_mm_counter_fast(vma->vm_mm, mm_counter_file(page));
|
||||
page_add_file_rmap(page, false);
|
||||
}
|
||||
set_pte_at(vma->vm_mm, vmf->address, vmf->pte, entry);
|
||||
set_pte_at(vma->vm_mm, addr, vmf->pte, entry);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4040,7 +4040,7 @@ vm_fault_t finish_fault(struct vm_fault *vmf)
|
||||
ret = 0;
|
||||
/* Re-check under ptl */
|
||||
if (likely(pte_none(*vmf->pte)))
|
||||
do_set_pte(vmf, page);
|
||||
do_set_pte(vmf, page, vmf->address);
|
||||
else
|
||||
ret = VM_FAULT_NOPAGE;
|
||||
|
||||
|
Reference in New Issue
Block a user