Commit 8b1e0f81 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Linus Torvalds

mm/pgtable: drop pgtable_t variable from pte_fn_t functions

Drop the pgtable_t variable from all implementation for pte_fn_t as none
of them use it.  apply_to_pte_range() should stop computing it as well.
Should help us save some cycles.

Link: http://lkml.kernel.org/r/1556803126-26596-1-git-send-email-anshuman.khandual@arm.comSigned-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Acked-by: default avatarMatthew Wilcox <willy@infradead.org>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Logan Gunthorpe <logang@deltatee.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: <jglisse@redhat.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c2471e79
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
#include <asm/mach/map.h> #include <asm/mach/map.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
static int __init set_permissions(pte_t *ptep, pgtable_t token, static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
efi_memory_desc_t *md = data; efi_memory_desc_t *md = data;
pte_t pte = *ptep; pte_t pte = *ptep;
......
...@@ -493,8 +493,7 @@ void __init dma_contiguous_remap(void) ...@@ -493,8 +493,7 @@ void __init dma_contiguous_remap(void)
} }
} }
static int __dma_update_pte(pte_t *pte, pgtable_t token, unsigned long addr, static int __dma_update_pte(pte_t *pte, unsigned long addr, void *data)
void *data)
{ {
struct page *page = virt_to_page(addr); struct page *page = virt_to_page(addr);
pgprot_t prot = *(pgprot_t *)data; pgprot_t prot = *(pgprot_t *)data;
......
...@@ -14,8 +14,7 @@ struct page_change_data { ...@@ -14,8 +14,7 @@ struct page_change_data {
pgprot_t clear_mask; pgprot_t clear_mask;
}; };
static int change_page_range(pte_t *ptep, pgtable_t token, unsigned long addr, static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
void *data)
{ {
struct page_change_data *cdata = data; struct page_change_data *cdata = data;
pte_t pte = *ptep; pte_t pte = *ptep;
......
...@@ -82,8 +82,7 @@ int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md) ...@@ -82,8 +82,7 @@ int __init efi_create_mapping(struct mm_struct *mm, efi_memory_desc_t *md)
return 0; return 0;
} }
static int __init set_permissions(pte_t *ptep, pgtable_t token, static int __init set_permissions(pte_t *ptep, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
efi_memory_desc_t *md = data; efi_memory_desc_t *md = data;
pte_t pte = READ_ONCE(*ptep); pte_t pte = READ_ONCE(*ptep);
......
...@@ -19,8 +19,7 @@ struct page_change_data { ...@@ -19,8 +19,7 @@ struct page_change_data {
bool rodata_full __ro_after_init = IS_ENABLED(CONFIG_RODATA_FULL_DEFAULT_ENABLED); bool rodata_full __ro_after_init = IS_ENABLED(CONFIG_RODATA_FULL_DEFAULT_ENABLED);
static int change_page_range(pte_t *ptep, pgtable_t token, unsigned long addr, static int change_page_range(pte_t *ptep, unsigned long addr, void *data)
void *data)
{ {
struct page_change_data *cdata = data; struct page_change_data *cdata = data;
pte_t pte = READ_ONCE(*ptep); pte_t pte = READ_ONCE(*ptep);
......
...@@ -2700,8 +2700,7 @@ struct remap_data { ...@@ -2700,8 +2700,7 @@ struct remap_data {
struct mmu_update *mmu_update; struct mmu_update *mmu_update;
}; };
static int remap_area_pfn_pte_fn(pte_t *ptep, pgtable_t token, static int remap_area_pfn_pte_fn(pte_t *ptep, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
struct remap_data *rmd = data; struct remap_data *rmd = data;
pte_t pte = pte_mkspecial(mfn_pte(*rmd->pfn, rmd->prot)); pte_t pte = pte_mkspecial(mfn_pte(*rmd->pfn, rmd->prot));
......
...@@ -35,8 +35,7 @@ struct remap_pfn { ...@@ -35,8 +35,7 @@ struct remap_pfn {
pgprot_t prot; pgprot_t prot;
}; };
static int remap_pfn(pte_t *pte, pgtable_t token, static int remap_pfn(pte_t *pte, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
struct remap_pfn *r = data; struct remap_pfn *r = data;
......
...@@ -264,8 +264,7 @@ void gntdev_put_map(struct gntdev_priv *priv, struct gntdev_grant_map *map) ...@@ -264,8 +264,7 @@ void gntdev_put_map(struct gntdev_priv *priv, struct gntdev_grant_map *map)
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static int find_grant_ptes(pte_t *pte, pgtable_t token, static int find_grant_ptes(pte_t *pte, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
struct gntdev_grant_map *map = data; struct gntdev_grant_map *map = data;
unsigned int pgnr = (addr - map->vma->vm_start) >> PAGE_SHIFT; unsigned int pgnr = (addr - map->vma->vm_start) >> PAGE_SHIFT;
...@@ -292,8 +291,7 @@ static int find_grant_ptes(pte_t *pte, pgtable_t token, ...@@ -292,8 +291,7 @@ static int find_grant_ptes(pte_t *pte, pgtable_t token,
} }
#ifdef CONFIG_X86 #ifdef CONFIG_X86
static int set_grant_ptes_as_special(pte_t *pte, pgtable_t token, static int set_grant_ptes_as_special(pte_t *pte, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
set_pte_at(current->mm, addr, pte, pte_mkspecial(*pte)); set_pte_at(current->mm, addr, pte, pte_mkspecial(*pte));
return 0; return 0;
......
...@@ -731,8 +731,7 @@ struct remap_pfn { ...@@ -731,8 +731,7 @@ struct remap_pfn {
unsigned long i; unsigned long i;
}; };
static int remap_pfn_fn(pte_t *ptep, pgtable_t token, unsigned long addr, static int remap_pfn_fn(pte_t *ptep, unsigned long addr, void *data)
void *data)
{ {
struct remap_pfn *r = data; struct remap_pfn *r = data;
struct page *page = r->pages[r->i]; struct page *page = r->pages[r->i];
...@@ -966,8 +965,7 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -966,8 +965,7 @@ static int privcmd_mmap(struct file *file, struct vm_area_struct *vma)
* on a per pfn/pte basis. Mapping calls that fail with ENOENT * on a per pfn/pte basis. Mapping calls that fail with ENOENT
* can be then retried until success. * can be then retried until success.
*/ */
static int is_mapped_fn(pte_t *pte, struct page *pmd_page, static int is_mapped_fn(pte_t *pte, unsigned long addr, void *data)
unsigned long addr, void *data)
{ {
return pte_none(*pte) ? 0 : -EBUSY; return pte_none(*pte) ? 0 : -EBUSY;
} }
......
...@@ -93,8 +93,7 @@ static void setup_hparams(unsigned long gfn, void *data) ...@@ -93,8 +93,7 @@ static void setup_hparams(unsigned long gfn, void *data)
info->fgfn++; info->fgfn++;
} }
static int remap_pte_fn(pte_t *ptep, pgtable_t token, unsigned long addr, static int remap_pte_fn(pte_t *ptep, unsigned long addr, void *data)
void *data)
{ {
struct remap_data *info = data; struct remap_data *info = data;
struct page *page = info->pages[info->index++]; struct page *page = info->pages[info->index++];
......
...@@ -2686,8 +2686,7 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags) ...@@ -2686,8 +2686,7 @@ static inline int vm_fault_to_errno(vm_fault_t vm_fault, int foll_flags)
return 0; return 0;
} }
typedef int (*pte_fn_t)(pte_t *pte, pgtable_t token, unsigned long addr, typedef int (*pte_fn_t)(pte_t *pte, unsigned long addr, void *data);
void *data);
extern int apply_to_page_range(struct mm_struct *mm, unsigned long address, extern int apply_to_page_range(struct mm_struct *mm, unsigned long address,
unsigned long size, pte_fn_t fn, void *data); unsigned long size, pte_fn_t fn, void *data);
......
...@@ -2036,7 +2036,6 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, ...@@ -2036,7 +2036,6 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
{ {
pte_t *pte; pte_t *pte;
int err; int err;
pgtable_t token;
spinlock_t *uninitialized_var(ptl); spinlock_t *uninitialized_var(ptl);
pte = (mm == &init_mm) ? pte = (mm == &init_mm) ?
...@@ -2049,10 +2048,8 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd, ...@@ -2049,10 +2048,8 @@ static int apply_to_pte_range(struct mm_struct *mm, pmd_t *pmd,
arch_enter_lazy_mmu_mode(); arch_enter_lazy_mmu_mode();
token = pmd_pgtable(*pmd);
do { do {
err = fn(pte++, token, addr, data); err = fn(pte++, addr, data);
if (err) if (err)
break; break;
} while (addr += PAGE_SIZE, addr != end); } while (addr += PAGE_SIZE, addr != end);
......
...@@ -2996,7 +2996,7 @@ void __weak vmalloc_sync_all(void) ...@@ -2996,7 +2996,7 @@ void __weak vmalloc_sync_all(void)
} }
static int f(pte_t *pte, pgtable_t table, unsigned long addr, void *data) static int f(pte_t *pte, unsigned long addr, void *data)
{ {
pte_t ***p = data; pte_t ***p = data;
......
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