Commit 34801ba9 authored by venkatesh.pallipadi@intel.com's avatar venkatesh.pallipadi@intel.com Committed by H. Peter Anvin

x86: PAT: move track untrack pfnmap stubs to asm-generic

Impact: Cleanup and branch hints only.

Move the track and untrack pfn stub routines from memory.c to asm-generic.
Also add unlikely to pfnmap related calls in fork and exit path.
Signed-off-by: default avatarVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Signed-off-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent 982d789a
...@@ -339,12 +339,10 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot) ...@@ -339,12 +339,10 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask) #define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
#ifndef __ASSEMBLY__
/* Indicate that x86 has its own track and untrack pfn vma functions */ /* Indicate that x86 has its own track and untrack pfn vma functions */
#define track_pfn_vma_new track_pfn_vma_new #define __HAVE_PFNMAP_TRACKING
#define track_pfn_vma_copy track_pfn_vma_copy
#define untrack_pfn_vma untrack_pfn_vma
#ifndef __ASSEMBLY__
#define __HAVE_PHYS_MEM_ACCESS_PROT #define __HAVE_PHYS_MEM_ACCESS_PROT
struct file; struct file;
pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn, pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
......
...@@ -293,6 +293,52 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm, ...@@ -293,6 +293,52 @@ static inline void ptep_modify_prot_commit(struct mm_struct *mm,
#define arch_flush_lazy_cpu_mode() do {} while (0) #define arch_flush_lazy_cpu_mode() do {} while (0)
#endif #endif
#ifndef __HAVE_PFNMAP_TRACKING
/*
* Interface that can be used by architecture code to keep track of
* memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
*
* track_pfn_vma_new is called when a _new_ pfn mapping is being established
* for physical range indicated by pfn and size.
*/
static inline int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
unsigned long pfn, unsigned long size)
{
return 0;
}
/*
* Interface that can be used by architecture code to keep track of
* memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
*
* track_pfn_vma_copy is called when vma that is covering the pfnmap gets
* copied through copy_page_range().
*/
static inline int track_pfn_vma_copy(struct vm_area_struct *vma)
{
return 0;
}
/*
* Interface that can be used by architecture code to keep track of
* memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
*
* untrack_pfn_vma is called while unmapping a pfnmap for a region.
* untrack can be called for a specific region indicated by pfn and size or
* can be for the entire vma (in which case size can be zero).
*/
static inline void untrack_pfn_vma(struct vm_area_struct *vma,
unsigned long pfn, unsigned long size)
{
}
#else
extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
unsigned long pfn, unsigned long size);
extern int track_pfn_vma_copy(struct vm_area_struct *vma);
extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
unsigned long size);
#endif
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLY__ */
#endif /* _ASM_GENERIC_PGTABLE_H */ #endif /* _ASM_GENERIC_PGTABLE_H */
...@@ -163,12 +163,6 @@ static inline int is_pfn_mapping(struct vm_area_struct *vma) ...@@ -163,12 +163,6 @@ static inline int is_pfn_mapping(struct vm_area_struct *vma)
return (vma->vm_flags & VM_PFNMAP); return (vma->vm_flags & VM_PFNMAP);
} }
extern int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
unsigned long pfn, unsigned long size);
extern int track_pfn_vma_copy(struct vm_area_struct *vma);
extern void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
unsigned long size);
/* /*
* vm_fault is filled by the the pagefault handler and passed to the vma's * vm_fault is filled by the the pagefault handler and passed to the vma's
* ->fault function. The vma's ->fault is responsible for returning a bitmask * ->fault function. The vma's ->fault is responsible for returning a bitmask
......
...@@ -99,50 +99,6 @@ int randomize_va_space __read_mostly = ...@@ -99,50 +99,6 @@ int randomize_va_space __read_mostly =
2; 2;
#endif #endif
#ifndef track_pfn_vma_new
/*
* Interface that can be used by architecture code to keep track of
* memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
*
* track_pfn_vma_new is called when a _new_ pfn mapping is being established
* for physical range indicated by pfn and size.
*/
int track_pfn_vma_new(struct vm_area_struct *vma, pgprot_t prot,
unsigned long pfn, unsigned long size)
{
return 0;
}
#endif
#ifndef track_pfn_vma_copy
/*
* Interface that can be used by architecture code to keep track of
* memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
*
* track_pfn_vma_copy is called when vma that is covering the pfnmap gets
* copied through copy_page_range().
*/
int track_pfn_vma_copy(struct vm_area_struct *vma)
{
return 0;
}
#endif
#ifndef untrack_pfn_vma
/*
* Interface that can be used by architecture code to keep track of
* memory type of pfn mappings (remap_pfn_range, vm_insert_pfn)
*
* untrack_pfn_vma is called while unmapping a pfnmap for a region.
* untrack can be called for a specific region indicated by pfn and size or
* can be for the entire vma (in which case size can be zero).
*/
void untrack_pfn_vma(struct vm_area_struct *vma, unsigned long pfn,
unsigned long size)
{
}
#endif
static int __init disable_randmaps(char *s) static int __init disable_randmaps(char *s)
{ {
randomize_va_space = 0; randomize_va_space = 0;
...@@ -713,7 +669,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, ...@@ -713,7 +669,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
if (is_vm_hugetlb_page(vma)) if (is_vm_hugetlb_page(vma))
return copy_hugetlb_page_range(dst_mm, src_mm, vma); return copy_hugetlb_page_range(dst_mm, src_mm, vma);
if (is_pfn_mapping(vma)) { if (unlikely(is_pfn_mapping(vma))) {
/* /*
* We do not free on error cases below as remove_vma * We do not free on error cases below as remove_vma
* gets called on error from higher level routine * gets called on error from higher level routine
...@@ -969,7 +925,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp, ...@@ -969,7 +925,7 @@ unsigned long unmap_vmas(struct mmu_gather **tlbp,
if (vma->vm_flags & VM_ACCOUNT) if (vma->vm_flags & VM_ACCOUNT)
*nr_accounted += (end - start) >> PAGE_SHIFT; *nr_accounted += (end - start) >> PAGE_SHIFT;
if (is_pfn_mapping(vma)) if (unlikely(is_pfn_mapping(vma)))
untrack_pfn_vma(vma, 0, 0); untrack_pfn_vma(vma, 0, 0);
while (start != end) { while (start != end) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment