Commit 701dfbc1cbdd42b814dd76a885c4b73f97011d08
Committed by
Linus Torvalds
1 parent
8339f0008c
Exists in
master
and in
4 other branches
[PATCH] mm: mremap correct rmap accounting
Nick Piggin points out that page accounting on MIPS multiple ZERO_PAGEs is not maintained by its move_pte, and could lead to freeing a ZERO_PAGE. Instead of complicating that move_pte, just forget the minor optimization when mremapping, and change the one thing which needed it for correctness - filemap_xip use ZERO_PAGE(0) throughout instead of according to address. [ "There is no block device driver one could use for XIP on mips platforms" - Carsten Otte ] Signed-off-by: Hugh Dickins <hugh@veritas.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Andrew Morton <akpm@osdl.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 3 changed files with 2 additions and 13 deletions Side-by-side Diff
include/asm-mips/pgtable.h
... | ... | @@ -69,16 +69,6 @@ |
69 | 69 | #define ZERO_PAGE(vaddr) \ |
70 | 70 | (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask)))) |
71 | 71 | |
72 | -#define __HAVE_ARCH_MOVE_PTE | |
73 | -#define move_pte(pte, prot, old_addr, new_addr) \ | |
74 | -({ \ | |
75 | - pte_t newpte = (pte); \ | |
76 | - if (pte_present(pte) && pfn_valid(pte_pfn(pte)) && \ | |
77 | - pte_page(pte) == ZERO_PAGE(old_addr)) \ | |
78 | - newpte = mk_pte(ZERO_PAGE(new_addr), (prot)); \ | |
79 | - newpte; \ | |
80 | -}) | |
81 | - | |
82 | 72 | extern void paging_init(void); |
83 | 73 | |
84 | 74 | /* |
mm/filemap_xip.c
... | ... | @@ -183,7 +183,7 @@ |
183 | 183 | address = vma->vm_start + |
184 | 184 | ((pgoff - vma->vm_pgoff) << PAGE_SHIFT); |
185 | 185 | BUG_ON(address < vma->vm_start || address >= vma->vm_end); |
186 | - page = ZERO_PAGE(address); | |
186 | + page = ZERO_PAGE(0); | |
187 | 187 | pte = page_check_address(page, mm, address, &ptl); |
188 | 188 | if (pte) { |
189 | 189 | /* Nuke the page table entry. */ |
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | __xip_unmap(mapping, pgoff); |
247 | 247 | } else { |
248 | 248 | /* not shared and writable, use ZERO_PAGE() */ |
249 | - page = ZERO_PAGE(address); | |
249 | + page = ZERO_PAGE(0); | |
250 | 250 | } |
251 | 251 | |
252 | 252 | out: |
mm/mremap.c
... | ... | @@ -105,7 +105,6 @@ |
105 | 105 | if (pte_none(*old_pte)) |
106 | 106 | continue; |
107 | 107 | pte = ptep_clear_flush(vma, old_addr, old_pte); |
108 | - /* ZERO_PAGE can be dependant on virtual addr */ | |
109 | 108 | pte = move_pte(pte, new_vma->vm_page_prot, old_addr, new_addr); |
110 | 109 | set_pte_at(mm, new_addr, new_pte, pte); |
111 | 110 | } |