x86: drop _PAGE_FILE and pte_file()-related helpers
We've replaced remap_file_pages(2) implementation with emulation. Nobody creates non-linear mapping anymore. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@redhat.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
40171798fe
commit
0a19136205
5 changed files with 2 additions and 77 deletions
|
@ -62,44 +62,8 @@ static inline unsigned long pte_bitop(unsigned long value, unsigned int rightshi
|
|||
return ((value >> rightshift) & mask) << leftshift;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bits _PAGE_BIT_PRESENT, _PAGE_BIT_FILE and _PAGE_BIT_PROTNONE are taken,
|
||||
* split up the 29 bits of offset into this range.
|
||||
*/
|
||||
#define PTE_FILE_MAX_BITS 29
|
||||
#define PTE_FILE_SHIFT1 (_PAGE_BIT_PRESENT + 1)
|
||||
#define PTE_FILE_SHIFT2 (_PAGE_BIT_FILE + 1)
|
||||
#define PTE_FILE_SHIFT3 (_PAGE_BIT_PROTNONE + 1)
|
||||
#define PTE_FILE_BITS1 (PTE_FILE_SHIFT2 - PTE_FILE_SHIFT1 - 1)
|
||||
#define PTE_FILE_BITS2 (PTE_FILE_SHIFT3 - PTE_FILE_SHIFT2 - 1)
|
||||
|
||||
#define PTE_FILE_MASK1 ((1U << PTE_FILE_BITS1) - 1)
|
||||
#define PTE_FILE_MASK2 ((1U << PTE_FILE_BITS2) - 1)
|
||||
|
||||
#define PTE_FILE_LSHIFT2 (PTE_FILE_BITS1)
|
||||
#define PTE_FILE_LSHIFT3 (PTE_FILE_BITS1 + PTE_FILE_BITS2)
|
||||
|
||||
static __always_inline pgoff_t pte_to_pgoff(pte_t pte)
|
||||
{
|
||||
return (pgoff_t)
|
||||
(pte_bitop(pte.pte_low, PTE_FILE_SHIFT1, PTE_FILE_MASK1, 0) +
|
||||
pte_bitop(pte.pte_low, PTE_FILE_SHIFT2, PTE_FILE_MASK2, PTE_FILE_LSHIFT2) +
|
||||
pte_bitop(pte.pte_low, PTE_FILE_SHIFT3, -1UL, PTE_FILE_LSHIFT3));
|
||||
}
|
||||
|
||||
static __always_inline pte_t pgoff_to_pte(pgoff_t off)
|
||||
{
|
||||
return (pte_t){
|
||||
.pte_low =
|
||||
pte_bitop(off, 0, PTE_FILE_MASK1, PTE_FILE_SHIFT1) +
|
||||
pte_bitop(off, PTE_FILE_LSHIFT2, PTE_FILE_MASK2, PTE_FILE_SHIFT2) +
|
||||
pte_bitop(off, PTE_FILE_LSHIFT3, -1UL, PTE_FILE_SHIFT3) +
|
||||
_PAGE_FILE,
|
||||
};
|
||||
}
|
||||
|
||||
/* Encode and de-code a swap entry */
|
||||
#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)
|
||||
#define SWP_TYPE_BITS 5
|
||||
#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 1)
|
||||
|
||||
#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > SWP_TYPE_BITS)
|
||||
|
|
|
@ -176,18 +176,6 @@ static inline pmd_t native_pmdp_get_and_clear(pmd_t *pmdp)
|
|||
#define native_pmdp_get_and_clear(xp) native_local_pmdp_get_and_clear(xp)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Bits 0, 6 and 7 are taken in the low part of the pte,
|
||||
* put the 32 bits of offset into the high part.
|
||||
*
|
||||
* For soft-dirty tracking 11 bit is taken from
|
||||
* the low part of pte as well.
|
||||
*/
|
||||
#define pte_to_pgoff(pte) ((pte).pte_high)
|
||||
#define pgoff_to_pte(off) \
|
||||
((pte_t) { { .pte_low = _PAGE_FILE, .pte_high = (off) } })
|
||||
#define PTE_FILE_MAX_BITS 32
|
||||
|
||||
/* Encode and de-code a swap entry */
|
||||
#define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > 5)
|
||||
#define __swp_type(x) (((x).val) & 0x1f)
|
||||
|
|
|
@ -115,11 +115,6 @@ static inline int pte_write(pte_t pte)
|
|||
return pte_flags(pte) & _PAGE_RW;
|
||||
}
|
||||
|
||||
static inline int pte_file(pte_t pte)
|
||||
{
|
||||
return pte_flags(pte) & _PAGE_FILE;
|
||||
}
|
||||
|
||||
static inline int pte_huge(pte_t pte)
|
||||
{
|
||||
return pte_flags(pte) & _PAGE_PSE;
|
||||
|
@ -329,21 +324,6 @@ static inline pmd_t pmd_mksoft_dirty(pmd_t pmd)
|
|||
return pmd_set_flags(pmd, _PAGE_SOFT_DIRTY);
|
||||
}
|
||||
|
||||
static inline pte_t pte_file_clear_soft_dirty(pte_t pte)
|
||||
{
|
||||
return pte_clear_flags(pte, _PAGE_SOFT_DIRTY);
|
||||
}
|
||||
|
||||
static inline pte_t pte_file_mksoft_dirty(pte_t pte)
|
||||
{
|
||||
return pte_set_flags(pte, _PAGE_SOFT_DIRTY);
|
||||
}
|
||||
|
||||
static inline int pte_file_soft_dirty(pte_t pte)
|
||||
{
|
||||
return pte_flags(pte) & _PAGE_SOFT_DIRTY;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_HAVE_ARCH_SOFT_DIRTY */
|
||||
|
||||
/*
|
||||
|
|
|
@ -133,10 +133,6 @@ static inline int pgd_large(pgd_t pgd) { return 0; }
|
|||
/* PUD - Level3 access */
|
||||
|
||||
/* PMD - Level 2 access */
|
||||
#define pte_to_pgoff(pte) ((pte_val((pte)) & PHYSICAL_PAGE_MASK) >> PAGE_SHIFT)
|
||||
#define pgoff_to_pte(off) ((pte_t) { .pte = ((off) << PAGE_SHIFT) | \
|
||||
_PAGE_FILE })
|
||||
#define PTE_FILE_MAX_BITS __PHYSICAL_MASK_SHIFT
|
||||
|
||||
/* PTE - Level 1 access. */
|
||||
|
||||
|
@ -145,7 +141,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; }
|
|||
#define pte_unmap(pte) ((void)(pte))/* NOP */
|
||||
|
||||
/* Encode and de-code a swap entry */
|
||||
#define SWP_TYPE_BITS (_PAGE_BIT_FILE - _PAGE_BIT_PRESENT - 1)
|
||||
#define SWP_TYPE_BITS 5
|
||||
#ifdef CONFIG_NUMA_BALANCING
|
||||
/* Automatic NUMA balancing needs to be distinguishable from swap entries */
|
||||
#define SWP_OFFSET_SHIFT (_PAGE_BIT_PROTNONE + 2)
|
||||
|
|
|
@ -38,8 +38,6 @@
|
|||
/* If _PAGE_BIT_PRESENT is clear, we use these: */
|
||||
/* - if the user mapped it with PROT_NONE; pte_present gives true */
|
||||
#define _PAGE_BIT_PROTNONE _PAGE_BIT_GLOBAL
|
||||
/* - set: nonlinear file mapping, saved PTE; unset:swap */
|
||||
#define _PAGE_BIT_FILE _PAGE_BIT_DIRTY
|
||||
|
||||
#define _PAGE_PRESENT (_AT(pteval_t, 1) << _PAGE_BIT_PRESENT)
|
||||
#define _PAGE_RW (_AT(pteval_t, 1) << _PAGE_BIT_RW)
|
||||
|
@ -114,7 +112,6 @@
|
|||
#define _PAGE_NX (_AT(pteval_t, 0))
|
||||
#endif
|
||||
|
||||
#define _PAGE_FILE (_AT(pteval_t, 1) << _PAGE_BIT_FILE)
|
||||
#define _PAGE_PROTNONE (_AT(pteval_t, 1) << _PAGE_BIT_PROTNONE)
|
||||
|
||||
#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
|
||||
|
|
Loading…
Reference in a new issue