summaryrefslogtreecommitdiffstats
path: root/mm/fremap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 14:03:14 -0800
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 14:03:14 -0800
commitc9cfcddfd65735437a4cb8563d6b66a6da8a5ed6 (patch)
tree618cdf37baafe8b283bcc9923d9dde89d6428fb5 /mm/fremap.c
parent4168f7a31801bba6acc18662978d24ec850bbbd0 (diff)
downloadlinux-stable-c9cfcddfd65735437a4cb8563d6b66a6da8a5ed6.tar.gz
linux-stable-c9cfcddfd65735437a4cb8563d6b66a6da8a5ed6.tar.bz2
linux-stable-c9cfcddfd65735437a4cb8563d6b66a6da8a5ed6.zip
VM: add common helper function to create the page tables
This logic was duplicated four times, for no good reason. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/fremap.c')
-rw-r--r--mm/fremap.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/mm/fremap.c b/mm/fremap.c
index f851775e09c2..9f381e58bf44 100644
--- a/mm/fremap.c
+++ b/mm/fremap.c
@@ -55,20 +55,10 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma,
pgoff_t size;
int err = -ENOMEM;
pte_t *pte;
- pmd_t *pmd;
- pud_t *pud;
- pgd_t *pgd;
pte_t pte_val;
spinlock_t *ptl;
- pgd = pgd_offset(mm, addr);
- pud = pud_alloc(mm, pgd, addr);
- if (!pud)
- goto out;
- pmd = pmd_alloc(mm, pud, addr);
- if (!pmd)
- goto out;
- pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
+ pte = get_locked_pte(mm, addr, &ptl);
if (!pte)
goto out;
@@ -110,20 +100,10 @@ int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma,
{
int err = -ENOMEM;
pte_t *pte;
- pmd_t *pmd;
- pud_t *pud;
- pgd_t *pgd;
pte_t pte_val;
spinlock_t *ptl;
- pgd = pgd_offset(mm, addr);
- pud = pud_alloc(mm, pgd, addr);
- if (!pud)
- goto out;
- pmd = pmd_alloc(mm, pud, addr);
- if (!pmd)
- goto out;
- pte = pte_alloc_map_lock(mm, pmd, addr, &ptl);
+ pte = get_locked_pte(mm, addr, &ptl);
if (!pte)
goto out;