aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/alpha/include/asm/pgtable.h2
-rw-r--r--arch/arm/include/asm/pgtable.h14
-rw-r--r--arch/arm/mm/fault-armv.c4
-rw-r--r--arch/arm/mm/pgd.c4
-rw-r--r--arch/avr32/include/asm/pgtable.h2
-rw-r--r--arch/cris/include/asm/pgtable.h2
-rw-r--r--arch/frv/include/asm/pgtable.h9
-rw-r--r--arch/ia64/include/asm/pgtable.h2
-rw-r--r--arch/m32r/include/asm/pgtable.h2
-rw-r--r--arch/m68k/include/asm/motorola_pgtable.h2
-rw-r--r--arch/m68k/include/asm/sun3_pgtable.h2
-rw-r--r--arch/microblaze/include/asm/pgtable.h7
-rw-r--r--arch/mips/include/asm/pgtable-32.h3
-rw-r--r--arch/mips/include/asm/pgtable-64.h3
-rw-r--r--arch/mn10300/include/asm/pgtable.h2
-rw-r--r--arch/parisc/include/asm/pgtable.h2
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc32.h8
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h2
-rw-r--r--arch/s390/include/asm/pgtable.h2
-rw-r--r--arch/score/include/asm/pgtable.h3
-rw-r--r--arch/sh/include/asm/pgtable_32.h3
-rw-r--r--arch/sh/include/asm/pgtable_64.h2
-rw-r--r--arch/sparc/include/asm/pgtable_32.h3
-rw-r--r--arch/sparc/include/asm/pgtable_64.h2
-rw-r--r--arch/tile/include/asm/pgtable.h5
-rw-r--r--arch/um/include/asm/pgtable.h2
-rw-r--r--arch/x86/include/asm/pgtable_32.h14
-rw-r--r--arch/x86/include/asm/pgtable_64.h2
-rw-r--r--arch/xtensa/include/asm/pgtable.h3
-rw-r--r--mm/memory.c4
-rw-r--r--mm/mremap.c4
31 files changed, 22 insertions, 99 deletions
diff --git a/arch/alpha/include/asm/pgtable.h b/arch/alpha/include/asm/pgtable.h
index 71a243294142..de98a732683d 100644
--- a/arch/alpha/include/asm/pgtable.h
+++ b/arch/alpha/include/asm/pgtable.h
@@ -318,9 +318,7 @@ extern inline pte_t * pte_offset_kernel(pmd_t * dir, unsigned long address)
318} 318}
319 319
320#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) 320#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr))
321#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr))
322#define pte_unmap(pte) do { } while (0) 321#define pte_unmap(pte) do { } while (0)
323#define pte_unmap_nested(pte) do { } while (0)
324 322
325extern pgd_t swapper_pg_dir[1024]; 323extern pgd_t swapper_pg_dir[1024];
326 324
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index a9672e8406a3..b155414192da 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -263,17 +263,15 @@ extern struct page *empty_zero_page;
263#define pte_page(pte) (pfn_to_page(pte_pfn(pte))) 263#define pte_page(pte) (pfn_to_page(pte_pfn(pte)))
264#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr)) 264#define pte_offset_kernel(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
265 265
266#define pte_offset_map(dir,addr) (__pte_map(dir, KM_PTE0) + __pte_index(addr)) 266#define pte_offset_map(dir,addr) (__pte_map(dir) + __pte_index(addr))
267#define pte_offset_map_nested(dir,addr) (__pte_map(dir, KM_PTE1) + __pte_index(addr)) 267#define pte_unmap(pte) __pte_unmap(pte)
268#define pte_unmap(pte) __pte_unmap(pte, KM_PTE0)
269#define pte_unmap_nested(pte) __pte_unmap(pte, KM_PTE1)
270 268
271#ifndef CONFIG_HIGHPTE 269#ifndef CONFIG_HIGHPTE
272#define __pte_map(dir,km) pmd_page_vaddr(*(dir)) 270#define __pte_map(dir) pmd_page_vaddr(*(dir))
273#define __pte_unmap(pte,km) do { } while (0) 271#define __pte_unmap(pte) do { } while (0)
274#else 272#else
275#define __pte_map(dir,km) ((pte_t *)kmap_atomic(pmd_page(*(dir)), km) + PTRS_PER_PTE) 273#define __pte_map(dir) ((pte_t *)kmap_atomic(pmd_page(*(dir))) + PTRS_PER_PTE)
276#define __pte_unmap(pte,km) kunmap_atomic((pte - PTRS_PER_PTE), km) 274#define __pte_unmap(pte) kunmap_atomic((pte - PTRS_PER_PTE))
277#endif 275#endif
278 276
279#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext) 277#define set_pte_ext(ptep,pte,ext) cpu_set_pte_ext(ptep,pte,ext)
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index 8440d952ba6d..c493d7244d3d 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -89,13 +89,13 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address,
89 * open-code the spin-locking. 89 * open-code the spin-locking.
90 */ 90 */
91 ptl = pte_lockptr(vma->vm_mm, pmd); 91 ptl = pte_lockptr(vma->vm_mm, pmd);
92 pte = pte_offset_map_nested(pmd, address); 92 pte = pte_offset_map(pmd, address);
93 spin_lock(ptl); 93 spin_lock(ptl);
94 94
95 ret = do_adjust_pte(vma, address, pfn, pte); 95 ret = do_adjust_pte(vma, address, pfn, pte);
96 96
97 spin_unlock(ptl); 97 spin_unlock(ptl);
98 pte_unmap_nested(pte); 98 pte_unmap(pte);
99 99
100 return ret; 100 return ret;
101} 101}
diff --git a/arch/arm/mm/pgd.c b/arch/arm/mm/pgd.c
index be5f58e153bf..69bbfc6645a6 100644
--- a/arch/arm/mm/pgd.c
+++ b/arch/arm/mm/pgd.c
@@ -57,9 +57,9 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
57 goto no_pte; 57 goto no_pte;
58 58
59 init_pmd = pmd_offset(init_pgd, 0); 59 init_pmd = pmd_offset(init_pgd, 0);
60 init_pte = pte_offset_map_nested(init_pmd, 0); 60 init_pte = pte_offset_map(init_pmd, 0);
61 set_pte_ext(new_pte, *init_pte, 0); 61 set_pte_ext(new_pte, *init_pte, 0);
62 pte_unmap_nested(init_pte); 62 pte_unmap(init_pte);
63 pte_unmap(new_pte); 63 pte_unmap(new_pte);
64 } 64 }
65 65
diff --git a/arch/avr32/include/asm/pgtable.h b/arch/avr32/include/asm/pgtable.h
index a9ae30c41e74..6fbfea61f7bb 100644
--- a/arch/avr32/include/asm/pgtable.h
+++ b/arch/avr32/include/asm/pgtable.h
@@ -319,9 +319,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
319#define pte_offset_kernel(dir, address) \ 319#define pte_offset_kernel(dir, address) \
320 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) 320 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
321#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 321#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
322#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
323#define pte_unmap(pte) do { } while (0) 322#define pte_unmap(pte) do { } while (0)
324#define pte_unmap_nested(pte) do { } while (0)
325 323
326struct vm_area_struct; 324struct vm_area_struct;
327extern void update_mmu_cache(struct vm_area_struct * vma, 325extern void update_mmu_cache(struct vm_area_struct * vma,
diff --git a/arch/cris/include/asm/pgtable.h b/arch/cris/include/asm/pgtable.h
index f63d6fccbc6c..9eaae217b21b 100644
--- a/arch/cris/include/asm/pgtable.h
+++ b/arch/cris/include/asm/pgtable.h
@@ -248,10 +248,8 @@ static inline pgd_t * pgd_offset(const struct mm_struct *mm, unsigned long addre
248 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) 248 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
249#define pte_offset_map(dir, address) \ 249#define pte_offset_map(dir, address) \
250 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 250 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
251#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
252 251
253#define pte_unmap(pte) do { } while (0) 252#define pte_unmap(pte) do { } while (0)
254#define pte_unmap_nested(pte) do { } while (0)
255#define pte_pfn(x) ((unsigned long)(__va((x).pte)) >> PAGE_SHIFT) 253#define pte_pfn(x) ((unsigned long)(__va((x).pte)) >> PAGE_SHIFT)
256#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)) 254#define pfn_pte(pfn, prot) __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
257 255
diff --git a/arch/frv/include/asm/pgtable.h b/arch/frv/include/asm/pgtable.h
index c18b0d32e636..6bc241e4b4f8 100644
--- a/arch/frv/include/asm/pgtable.h
+++ b/arch/frv/include/asm/pgtable.h
@@ -451,17 +451,12 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
451 451
452#if defined(CONFIG_HIGHPTE) 452#if defined(CONFIG_HIGHPTE)
453#define pte_offset_map(dir, address) \ 453#define pte_offset_map(dir, address) \
454 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address)) 454 ((pte_t *)kmap_atomic(pmd_page(*(dir))) + pte_index(address))
455#define pte_offset_map_nested(dir, address) \ 455#define pte_unmap(pte) kunmap_atomic(pte)
456 ((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address))
457#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
458#define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
459#else 456#else
460#define pte_offset_map(dir, address) \ 457#define pte_offset_map(dir, address) \
461 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 458 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
462#define pte_offset_map_nested(dir, address) pte_offset_map((dir), (address))
463#define pte_unmap(pte) do { } while (0) 459#define pte_unmap(pte) do { } while (0)
464#define pte_unmap_nested(pte) do { } while (0)
465#endif 460#endif
466 461
467/* 462/*
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index c3286f42e501..1a97af31ef17 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -406,9 +406,7 @@ pgd_offset (const struct mm_struct *mm, unsigned long address)
406#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 406#define pte_index(addr) (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
407#define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) 407#define pte_offset_kernel(dir,addr) ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr))
408#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) 408#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr)
409#define pte_offset_map_nested(dir,addr) pte_offset_map(dir, addr)
410#define pte_unmap(pte) do { } while (0) 409#define pte_unmap(pte) do { } while (0)
411#define pte_unmap_nested(pte) do { } while (0)
412 410
413/* atomic versions of the some PTE manipulations: */ 411/* atomic versions of the some PTE manipulations: */
414 412
diff --git a/arch/m32r/include/asm/pgtable.h b/arch/m32r/include/asm/pgtable.h
index e6359c566b50..8a28cfea2729 100644
--- a/arch/m32r/include/asm/pgtable.h
+++ b/arch/m32r/include/asm/pgtable.h
@@ -332,9 +332,7 @@ static inline void pmd_set(pmd_t * pmdp, pte_t * ptep)
332 ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address)) 332 ((pte_t *)pmd_page_vaddr(*(dir)) + pte_index(address))
333#define pte_offset_map(dir, address) \ 333#define pte_offset_map(dir, address) \
334 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 334 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
335#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
336#define pte_unmap(pte) do { } while (0) 335#define pte_unmap(pte) do { } while (0)
337#define pte_unmap_nested(pte) do { } while (0)
338 336
339/* Encode and de-code a swap entry */ 337/* Encode and de-code a swap entry */
340#define __swp_type(x) (((x).val >> 2) & 0x1f) 338#define __swp_type(x) (((x).val >> 2) & 0x1f)
diff --git a/arch/m68k/include/asm/motorola_pgtable.h b/arch/m68k/include/asm/motorola_pgtable.h
index 8e9a8a754dde..45bd3f589bf0 100644
--- a/arch/m68k/include/asm/motorola_pgtable.h
+++ b/arch/m68k/include/asm/motorola_pgtable.h
@@ -221,9 +221,7 @@ static inline pte_t *pte_offset_kernel(pmd_t *pmdp, unsigned long address)
221} 221}
222 222
223#define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 223#define pte_offset_map(pmdp,address) ((pte_t *)__pmd_page(*pmdp) + (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
224#define pte_offset_map_nested(pmdp, address) pte_offset_map(pmdp, address)
225#define pte_unmap(pte) ((void)0) 224#define pte_unmap(pte) ((void)0)
226#define pte_unmap_nested(pte) ((void)0)
227 225
228/* 226/*
229 * Allocate and free page tables. The xxx_kernel() versions are 227 * Allocate and free page tables. The xxx_kernel() versions are
diff --git a/arch/m68k/include/asm/sun3_pgtable.h b/arch/m68k/include/asm/sun3_pgtable.h
index f847ec732d62..cf5fad9b5250 100644
--- a/arch/m68k/include/asm/sun3_pgtable.h
+++ b/arch/m68k/include/asm/sun3_pgtable.h
@@ -219,9 +219,7 @@ static inline pte_t pgoff_to_pte(unsigned off)
219#define pte_offset_kernel(pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address)) 219#define pte_offset_kernel(pmd, address) ((pte_t *) __pmd_page(*pmd) + pte_index(address))
220/* FIXME: should we bother with kmap() here? */ 220/* FIXME: should we bother with kmap() here? */
221#define pte_offset_map(pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_index(address)) 221#define pte_offset_map(pmd, address) ((pte_t *)kmap(pmd_page(*pmd)) + pte_index(address))
222#define pte_offset_map_nested(pmd, address) pte_offset_map(pmd, address)
223#define pte_unmap(pte) kunmap(pte) 222#define pte_unmap(pte) kunmap(pte)
224#define pte_unmap_nested(pte) kunmap(pte)
225 223
226/* Macros to (de)construct the fake PTEs representing swap pages. */ 224/* Macros to (de)construct the fake PTEs representing swap pages. */
227#define __swp_type(x) ((x).val & 0x7F) 225#define __swp_type(x) ((x).val & 0x7F)
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index d4f421672d3b..cae268c22ba2 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -504,12 +504,9 @@ static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address)
504#define pte_offset_kernel(dir, addr) \ 504#define pte_offset_kernel(dir, addr) \
505 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) 505 ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr))
506#define pte_offset_map(dir, addr) \ 506#define pte_offset_map(dir, addr) \
507 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) 507 ((pte_t *) kmap_atomic(pmd_page(*(dir))) + pte_index(addr))
508#define pte_offset_map_nested(dir, addr) \
509 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr))
510 508
511#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0) 509#define pte_unmap(pte) kunmap_atomic(pte)
512#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
513 510
514/* Encode and decode a nonlinear file mapping entry */ 511/* Encode and decode a nonlinear file mapping entry */
515#define PTE_FILE_MAX_BITS 29 512#define PTE_FILE_MAX_BITS 29
diff --git a/arch/mips/include/asm/pgtable-32.h b/arch/mips/include/asm/pgtable-32.h
index ae90412556d0..8a153d2fa62a 100644
--- a/arch/mips/include/asm/pgtable-32.h
+++ b/arch/mips/include/asm/pgtable-32.h
@@ -154,10 +154,7 @@ pfn_pte(unsigned long pfn, pgprot_t prot)
154 154
155#define pte_offset_map(dir, address) \ 155#define pte_offset_map(dir, address) \
156 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 156 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
157#define pte_offset_map_nested(dir, address) \
158 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
159#define pte_unmap(pte) ((void)(pte)) 157#define pte_unmap(pte) ((void)(pte))
160#define pte_unmap_nested(pte) ((void)(pte))
161 158
162#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX) 159#if defined(CONFIG_CPU_R3000) || defined(CONFIG_CPU_TX39XX)
163 160
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index 1be4b0fa30da..f00896087dda 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -257,10 +257,7 @@ static inline pmd_t *pmd_offset(pud_t * pud, unsigned long address)
257 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address)) 257 ((pte_t *) pmd_page_vaddr(*(dir)) + __pte_offset(address))
258#define pte_offset_map(dir, address) \ 258#define pte_offset_map(dir, address) \
259 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 259 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
260#define pte_offset_map_nested(dir, address) \
261 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
262#define pte_unmap(pte) ((void)(pte)) 260#define pte_unmap(pte) ((void)(pte))
263#define pte_unmap_nested(pte) ((void)(pte))
264 261
265/* 262/*
266 * Initialize a new pgd / pmd table with invalid pointers. 263 * Initialize a new pgd / pmd table with invalid pointers.
diff --git a/arch/mn10300/include/asm/pgtable.h b/arch/mn10300/include/asm/pgtable.h
index 16d88577f3e0..b049a8bd1577 100644
--- a/arch/mn10300/include/asm/pgtable.h
+++ b/arch/mn10300/include/asm/pgtable.h
@@ -457,9 +457,7 @@ static inline int set_kernel_exec(unsigned long vaddr, int enable)
457 457
458#define pte_offset_map(dir, address) \ 458#define pte_offset_map(dir, address) \
459 ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address)) 459 ((pte_t *) page_address(pmd_page(*(dir))) + pte_index(address))
460#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
461#define pte_unmap(pte) do {} while (0) 460#define pte_unmap(pte) do {} while (0)
462#define pte_unmap_nested(pte) do {} while (0)
463 461
464/* 462/*
465 * The MN10300 has external MMU info in the form of a TLB: this is adapted from 463 * The MN10300 has external MMU info in the form of a TLB: this is adapted from
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 01c15035e783..865f37a8a881 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -397,9 +397,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
397#define pte_offset_kernel(pmd, address) \ 397#define pte_offset_kernel(pmd, address) \
398 ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address)) 398 ((pte_t *) pmd_page_vaddr(*(pmd)) + pte_index(address))
399#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) 399#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
400#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
401#define pte_unmap(pte) do { } while (0) 400#define pte_unmap(pte) do { } while (0)
402#define pte_unmap_nested(pte) do { } while (0)
403 401
404#define pte_unmap(pte) do { } while (0) 402#define pte_unmap(pte) do { } while (0)
405#define pte_unmap_nested(pte) do { } while (0) 403#define pte_unmap_nested(pte) do { } while (0)
diff --git a/arch/powerpc/include/asm/pgtable-ppc32.h b/arch/powerpc/include/asm/pgtable-ppc32.h
index a7db96f2b5c3..47edde8c3556 100644
--- a/arch/powerpc/include/asm/pgtable-ppc32.h
+++ b/arch/powerpc/include/asm/pgtable-ppc32.h
@@ -308,12 +308,8 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
308#define pte_offset_kernel(dir, addr) \ 308#define pte_offset_kernel(dir, addr) \
309 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr)) 309 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(addr))
310#define pte_offset_map(dir, addr) \ 310#define pte_offset_map(dir, addr) \
311 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE0) + pte_index(addr)) 311 ((pte_t *) kmap_atomic(pmd_page(*(dir))) + pte_index(addr))
312#define pte_offset_map_nested(dir, addr) \ 312#define pte_unmap(pte) kunmap_atomic(pte)
313 ((pte_t *) kmap_atomic(pmd_page(*(dir)), KM_PTE1) + pte_index(addr))
314
315#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
316#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
317 313
318/* 314/*
319 * Encode and decode a swap entry. 315 * Encode and decode a swap entry.
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 49865045d56f..2b09cd522d33 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -193,9 +193,7 @@
193 (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 193 (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
194 194
195#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) 195#define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr))
196#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir), (addr))
197#define pte_unmap(pte) do { } while(0) 196#define pte_unmap(pte) do { } while(0)
198#define pte_unmap_nested(pte) do { } while(0)
199 197
200/* to find an entry in a kernel page-table-directory */ 198/* to find an entry in a kernel page-table-directory */
201/* This now only contains the vmalloc pages */ 199/* This now only contains the vmalloc pages */
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 986dc9476c21..02ace3491c51 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1094,9 +1094,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
1094#define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr)) 1094#define pte_offset(pmd, addr) ((pte_t *) pmd_deref(*(pmd)) + pte_index(addr))
1095#define pte_offset_kernel(pmd, address) pte_offset(pmd,address) 1095#define pte_offset_kernel(pmd, address) pte_offset(pmd,address)
1096#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address) 1096#define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
1097#define pte_offset_map_nested(pmd, address) pte_offset_kernel(pmd, address)
1098#define pte_unmap(pte) do { } while (0) 1097#define pte_unmap(pte) do { } while (0)
1099#define pte_unmap_nested(pte) do { } while (0)
1100 1098
1101/* 1099/*
1102 * 31 bit swap entry format: 1100 * 31 bit swap entry format:
diff --git a/arch/score/include/asm/pgtable.h b/arch/score/include/asm/pgtable.h
index ccf38f06c57d..2fd469807683 100644
--- a/arch/score/include/asm/pgtable.h
+++ b/arch/score/include/asm/pgtable.h
@@ -88,10 +88,7 @@ static inline void pmd_clear(pmd_t *pmdp)
88 88
89#define pte_offset_map(dir, address) \ 89#define pte_offset_map(dir, address) \
90 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) 90 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
91#define pte_offset_map_nested(dir, address) \
92 ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address))
93#define pte_unmap(pte) ((void)(pte)) 91#define pte_unmap(pte) ((void)(pte))
94#define pte_unmap_nested(pte) ((void)(pte))
95 92
96/* 93/*
97 * Bits 9(_PAGE_PRESENT) and 10(_PAGE_FILE)are taken, 94 * Bits 9(_PAGE_PRESENT) and 10(_PAGE_FILE)are taken,
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
index e172d696e52b..69fdfbf14ea5 100644
--- a/arch/sh/include/asm/pgtable_32.h
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -429,10 +429,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
429#define pte_offset_kernel(dir, address) \ 429#define pte_offset_kernel(dir, address) \
430 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) 430 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
431#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 431#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
432#define pte_offset_map_nested(dir, address) pte_offset_kernel(dir, address)
433
434#define pte_unmap(pte) do { } while (0) 432#define pte_unmap(pte) do { } while (0)
435#define pte_unmap_nested(pte) do { } while (0)
436 433
437#ifdef CONFIG_X2TLB 434#ifdef CONFIG_X2TLB
438#define pte_ERROR(e) \ 435#define pte_ERROR(e) \
diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h
index 0ee46776dad6..10a48111226d 100644
--- a/arch/sh/include/asm/pgtable_64.h
+++ b/arch/sh/include/asm/pgtable_64.h
@@ -84,9 +84,7 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
84 ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr))) 84 ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr)))
85 85
86#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr) 86#define pte_offset_map(dir,addr) pte_offset_kernel(dir, addr)
87#define pte_offset_map_nested(dir,addr) pte_offset_kernel(dir, addr)
88#define pte_unmap(pte) do { } while (0) 87#define pte_unmap(pte) do { } while (0)
89#define pte_unmap_nested(pte) do { } while (0)
90 88
91#ifndef __ASSEMBLY__ 89#ifndef __ASSEMBLY__
92#define IOBASE_VADDR 0xff000000 90#define IOBASE_VADDR 0xff000000
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index 0ece77f47753..303bd4dc8292 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -304,10 +304,7 @@ BTFIXUPDEF_CALL(pte_t *, pte_offset_kernel, pmd_t *, unsigned long)
304 * and sun4c is guaranteed to have no highmem anyway. 304 * and sun4c is guaranteed to have no highmem anyway.
305 */ 305 */
306#define pte_offset_map(d, a) pte_offset_kernel(d,a) 306#define pte_offset_map(d, a) pte_offset_kernel(d,a)
307#define pte_offset_map_nested(d, a) pte_offset_kernel(d,a)
308
309#define pte_unmap(pte) do{}while(0) 307#define pte_unmap(pte) do{}while(0)
310#define pte_unmap_nested(pte) do{}while(0)
311 308
312/* Certain architectures need to do special things when pte's 309/* Certain architectures need to do special things when pte's
313 * within a page table are directly modified. Thus, the following 310 * within a page table are directly modified. Thus, the following
diff --git a/arch/sparc/include/asm/pgtable_64.h b/arch/sparc/include/asm/pgtable_64.h
index f5b5fa76c02d..f8dddb7045bb 100644
--- a/arch/sparc/include/asm/pgtable_64.h
+++ b/arch/sparc/include/asm/pgtable_64.h
@@ -652,9 +652,7 @@ static inline int pte_special(pte_t pte)
652 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) 652 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)))
653#define pte_offset_kernel pte_index 653#define pte_offset_kernel pte_index
654#define pte_offset_map pte_index 654#define pte_offset_map pte_index
655#define pte_offset_map_nested pte_index
656#define pte_unmap(pte) do { } while (0) 655#define pte_unmap(pte) do { } while (0)
657#define pte_unmap_nested(pte) do { } while (0)
658 656
659/* Actual page table PTE updates. */ 657/* Actual page table PTE updates. */
660extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, pte_t *ptep, pte_t orig); 658extern void tlb_batch_add(struct mm_struct *mm, unsigned long vaddr, pte_t *ptep, pte_t orig);
diff --git a/arch/tile/include/asm/pgtable.h b/arch/tile/include/asm/pgtable.h
index b3367379d537..dc4ccdd855bc 100644
--- a/arch/tile/include/asm/pgtable.h
+++ b/arch/tile/include/asm/pgtable.h
@@ -347,15 +347,10 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
347extern pte_t *_pte_offset_map(pmd_t *, unsigned long address, enum km_type); 347extern pte_t *_pte_offset_map(pmd_t *, unsigned long address, enum km_type);
348#define pte_offset_map(dir, address) \ 348#define pte_offset_map(dir, address) \
349 _pte_offset_map(dir, address, KM_PTE0) 349 _pte_offset_map(dir, address, KM_PTE0)
350#define pte_offset_map_nested(dir, address) \
351 _pte_offset_map(dir, address, KM_PTE1)
352#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0) 350#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
353#define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
354#else 351#else
355#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 352#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
356#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
357#define pte_unmap(pte) do { } while (0) 353#define pte_unmap(pte) do { } while (0)
358#define pte_unmap_nested(pte) do { } while (0)
359#endif 354#endif
360 355
361/* Clear a non-executable kernel PTE and flush it from the TLB. */ 356/* Clear a non-executable kernel PTE and flush it from the TLB. */
diff --git a/arch/um/include/asm/pgtable.h b/arch/um/include/asm/pgtable.h
index a9f7251b4a8d..41474fb5eee7 100644
--- a/arch/um/include/asm/pgtable.h
+++ b/arch/um/include/asm/pgtable.h
@@ -338,9 +338,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
338 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) 338 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
339#define pte_offset_map(dir, address) \ 339#define pte_offset_map(dir, address) \
340 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address)) 340 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
341#define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
342#define pte_unmap(pte) do { } while (0) 341#define pte_unmap(pte) do { } while (0)
343#define pte_unmap_nested(pte) do { } while (0)
344 342
345struct mm_struct; 343struct mm_struct;
346extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr); 344extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h
index 8abde9ec90bf..0c92113c4cb6 100644
--- a/arch/x86/include/asm/pgtable_32.h
+++ b/arch/x86/include/asm/pgtable_32.h
@@ -49,24 +49,14 @@ extern void set_pmd_pfn(unsigned long, unsigned long, pgprot_t);
49#endif 49#endif
50 50
51#if defined(CONFIG_HIGHPTE) 51#if defined(CONFIG_HIGHPTE)
52#define __KM_PTE \
53 (in_nmi() ? KM_NMI_PTE : \
54 in_irq() ? KM_IRQ_PTE : \
55 KM_PTE0)
56#define pte_offset_map(dir, address) \ 52#define pte_offset_map(dir, address) \
57 ((pte_t *)kmap_atomic(pmd_page(*(dir)), __KM_PTE) + \ 53 ((pte_t *)kmap_atomic(pmd_page(*(dir))) + \
58 pte_index((address))) 54 pte_index((address)))
59#define pte_offset_map_nested(dir, address) \ 55#define pte_unmap(pte) kunmap_atomic((pte))
60 ((pte_t *)kmap_atomic(pmd_page(*(dir)), KM_PTE1) + \
61 pte_index((address)))
62#define pte_unmap(pte) kunmap_atomic((pte), __KM_PTE)
63#define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
64#else 56#else
65#define pte_offset_map(dir, address) \ 57#define pte_offset_map(dir, address) \
66 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address))) 58 ((pte_t *)page_address(pmd_page(*(dir))) + pte_index((address)))
67#define pte_offset_map_nested(dir, address) pte_offset_map((dir), (address))
68#define pte_unmap(pte) do { } while (0) 59#define pte_unmap(pte) do { } while (0)
69#define pte_unmap_nested(pte) do { } while (0)
70#endif 60#endif
71 61
72/* Clear a kernel PTE and flush it from the TLB */ 62/* Clear a kernel PTE and flush it from the TLB */
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index f96ac9bedf75..f86da20347f2 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -127,9 +127,7 @@ static inline int pgd_large(pgd_t pgd) { return 0; }
127 127
128/* x86-64 always has all page tables mapped. */ 128/* x86-64 always has all page tables mapped. */
129#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address)) 129#define pte_offset_map(dir, address) pte_offset_kernel((dir), (address))
130#define pte_offset_map_nested(dir, address) pte_offset_kernel((dir), (address))
131#define pte_unmap(pte) ((void)(pte))/* NOP */ 130#define pte_unmap(pte) ((void)(pte))/* NOP */
132#define pte_unmap_nested(pte) ((void)(pte)) /* NOP */
133 131
134#define update_mmu_cache(vma, address, ptep) do { } while (0) 132#define update_mmu_cache(vma, address, ptep) do { } while (0)
135 133
diff --git a/arch/xtensa/include/asm/pgtable.h b/arch/xtensa/include/asm/pgtable.h
index 76bf35554117..b03c043ce75b 100644
--- a/arch/xtensa/include/asm/pgtable.h
+++ b/arch/xtensa/include/asm/pgtable.h
@@ -324,10 +324,7 @@ ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
324#define pte_offset_kernel(dir,addr) \ 324#define pte_offset_kernel(dir,addr) \
325 ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr)) 325 ((pte_t*) pmd_page_vaddr(*(dir)) + pte_index(addr))
326#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr)) 326#define pte_offset_map(dir,addr) pte_offset_kernel((dir),(addr))
327#define pte_offset_map_nested(dir,addr) pte_offset_kernel((dir),(addr))
328
329#define pte_unmap(pte) do { } while (0) 327#define pte_unmap(pte) do { } while (0)
330#define pte_unmap_nested(pte) do { } while (0)
331 328
332 329
333/* 330/*
diff --git a/mm/memory.c b/mm/memory.c
index af82741caaa4..92cc54e94137 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -736,7 +736,7 @@ again:
736 dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl); 736 dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
737 if (!dst_pte) 737 if (!dst_pte)
738 return -ENOMEM; 738 return -ENOMEM;
739 src_pte = pte_offset_map_nested(src_pmd, addr); 739 src_pte = pte_offset_map(src_pmd, addr);
740 src_ptl = pte_lockptr(src_mm, src_pmd); 740 src_ptl = pte_lockptr(src_mm, src_pmd);
741 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); 741 spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
742 orig_src_pte = src_pte; 742 orig_src_pte = src_pte;
@@ -767,7 +767,7 @@ again:
767 767
768 arch_leave_lazy_mmu_mode(); 768 arch_leave_lazy_mmu_mode();
769 spin_unlock(src_ptl); 769 spin_unlock(src_ptl);
770 pte_unmap_nested(orig_src_pte); 770 pte_unmap(orig_src_pte);
771 add_mm_rss_vec(dst_mm, rss); 771 add_mm_rss_vec(dst_mm, rss);
772 pte_unmap_unlock(orig_dst_pte, dst_ptl); 772 pte_unmap_unlock(orig_dst_pte, dst_ptl);
773 cond_resched(); 773 cond_resched();
diff --git a/mm/mremap.c b/mm/mremap.c
index cde56ee51ef7..563fbdd6293a 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -101,7 +101,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
101 * pte locks because exclusive mmap_sem prevents deadlock. 101 * pte locks because exclusive mmap_sem prevents deadlock.
102 */ 102 */
103 old_pte = pte_offset_map_lock(mm, old_pmd, old_addr, &old_ptl); 103 old_pte = pte_offset_map_lock(mm, old_pmd, old_addr, &old_ptl);
104 new_pte = pte_offset_map_nested(new_pmd, new_addr); 104 new_pte = pte_offset_map(new_pmd, new_addr);
105 new_ptl = pte_lockptr(mm, new_pmd); 105 new_ptl = pte_lockptr(mm, new_pmd);
106 if (new_ptl != old_ptl) 106 if (new_ptl != old_ptl)
107 spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING); 107 spin_lock_nested(new_ptl, SINGLE_DEPTH_NESTING);
@@ -119,7 +119,7 @@ static void move_ptes(struct vm_area_struct *vma, pmd_t *old_pmd,
119 arch_leave_lazy_mmu_mode(); 119 arch_leave_lazy_mmu_mode();
120 if (new_ptl != old_ptl) 120 if (new_ptl != old_ptl)
121 spin_unlock(new_ptl); 121 spin_unlock(new_ptl);
122 pte_unmap_nested(new_pte - 1); 122 pte_unmap(new_pte - 1);
123 pte_unmap_unlock(old_pte - 1, old_ptl); 123 pte_unmap_unlock(old_pte - 1, old_ptl);
124 if (mapping) 124 if (mapping)
125 spin_unlock(&mapping->i_mmap_lock); 125 spin_unlock(&mapping->i_mmap_lock);