mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 14:04:54 +02:00
FROMLIST: mm: introduce __vm_normal_page()
When dealing with the speculative fault path we should use the VMA's field cached value stored in the vm_fault structure. Currently vm_normal_page() is using the pointer to the VMA to fetch the vm_flags value. This patch provides a new __vm_normal_page() which is receiving the vm_flags flags value as parameter. Note: The speculative path is turned on for architecture providing support for special PTE flag. So only the first block of vm_normal_page is used during the speculative path. Change-Id: I0f2c4ab1212fbca449bdf6e7993dafa0d41044bc Signed-off-by: Laurent Dufour <ldufour@linux.vnet.ibm.com> Link: https://lore.kernel.org/lkml/1523975611-15978-16-git-send-email-ldufour@linux.vnet.ibm.com/ Bug: 161210518 Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org> Signed-off-by: Charan Teja Reddy <charante@codeaurora.org>
This commit is contained in:
parent
cbff8f3907
commit
10a5eb6be8
|
|
@ -1669,8 +1669,14 @@ struct zap_details {
|
|||
pgoff_t last_index; /* Highest page->index to unmap */
|
||||
};
|
||||
|
||||
struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
||||
pte_t pte);
|
||||
struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
||||
pte_t pte, unsigned long vma_flags);
|
||||
static inline struct page *vm_normal_page(struct vm_area_struct *vma,
|
||||
unsigned long addr, pte_t pte)
|
||||
{
|
||||
return _vm_normal_page(vma, addr, pte, vma->vm_flags);
|
||||
}
|
||||
|
||||
struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr,
|
||||
pmd_t pmd);
|
||||
|
||||
|
|
|
|||
24
mm/memory.c
24
mm/memory.c
|
|
@ -568,7 +568,8 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
|
|||
}
|
||||
|
||||
/*
|
||||
* vm_normal_page -- This function gets the "struct page" associated with a pte.
|
||||
* __vm_normal_page -- This function gets the "struct page" associated with
|
||||
* a pte.
|
||||
*
|
||||
* "Special" mappings do not wish to be associated with a "struct page" (either
|
||||
* it doesn't exist, or it exists but they don't want to touch it). In this
|
||||
|
|
@ -609,8 +610,8 @@ static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr,
|
|||
* PFNMAP mappings in order to support COWable mappings.
|
||||
*
|
||||
*/
|
||||
struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
||||
pte_t pte)
|
||||
struct page *_vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
||||
pte_t pte, unsigned long vma_flags)
|
||||
{
|
||||
unsigned long pfn = pte_pfn(pte);
|
||||
|
||||
|
|
@ -619,7 +620,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
|||
goto check_pfn;
|
||||
if (vma->vm_ops && vma->vm_ops->find_special_page)
|
||||
return vma->vm_ops->find_special_page(vma, addr);
|
||||
if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP))
|
||||
if (vma_flags & (VM_PFNMAP | VM_MIXEDMAP))
|
||||
return NULL;
|
||||
if (is_zero_pfn(pfn))
|
||||
return NULL;
|
||||
|
|
@ -631,9 +632,13 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
|||
}
|
||||
|
||||
/* !CONFIG_ARCH_HAS_PTE_SPECIAL case follows: */
|
||||
/*
|
||||
* This part should never get called when CONFIG_SPECULATIVE_PAGE_FAULT
|
||||
* is set. This is mainly because we can't rely on vm_start.
|
||||
*/
|
||||
|
||||
if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
|
||||
if (vma->vm_flags & VM_MIXEDMAP) {
|
||||
if (unlikely(vma_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
|
||||
if (vma_flags & VM_MIXEDMAP) {
|
||||
if (!pfn_valid(pfn))
|
||||
return NULL;
|
||||
goto out;
|
||||
|
|
@ -642,7 +647,7 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
|
|||
off = (addr - vma->vm_start) >> PAGE_SHIFT;
|
||||
if (pfn == vma->vm_pgoff + off)
|
||||
return NULL;
|
||||
if (!is_cow_mapping(vma->vm_flags))
|
||||
if (!is_cow_mapping(vma_flags))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -3137,7 +3142,8 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
|
|||
return handle_userfault(vmf, VM_UFFD_WP);
|
||||
}
|
||||
|
||||
vmf->page = vm_normal_page(vma, vmf->address, vmf->orig_pte);
|
||||
vmf->page = _vm_normal_page(vma, vmf->address, vmf->orig_pte,
|
||||
vmf->vma_flags);
|
||||
if (!vmf->page) {
|
||||
/*
|
||||
* VM_MIXEDMAP !pfn_valid() case, or VM_SOFTDIRTY clear on a
|
||||
|
|
@ -4279,7 +4285,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
|
|||
ptep_modify_prot_commit(vma, vmf->address, vmf->pte, old_pte, pte);
|
||||
update_mmu_cache(vma, vmf->address, vmf->pte);
|
||||
|
||||
page = vm_normal_page(vma, vmf->address, pte);
|
||||
page = _vm_normal_page(vma, vmf->address, pte, vmf->vma_flags);
|
||||
if (!page) {
|
||||
pte_unmap_unlock(vmf->pte, vmf->ptl);
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user