
From: Hugh Dickins <hugh@veritas.com>

anonjrmap 6/6 updates to arches other than i386

Some arches refer to page->mapping for their cache flushing,
generally use page_mapping instead: it appears that they're
coping with shared pagecache issues, rather than anon swap.

Change put_dirty_page(current,,) to put_stack_page(mpnt,,).
No special page table initialization needed for rmap.
Delete pte_addr_t from asm/pgtable.h.  Delete asm/rmap.h.

There's some peculiar __users code in asm-s390*/pgtable.h,
looks bogus to me (those counts are included in page_count),
I've just deleted but should confirm with Martin.  And a
fix in asm-sh/pgalloc.h: use list_empty on i_mmap_shared.

No i386 files in this patch: but note that with pte_addr_t
gone, its PAE struct page is the same size as without PAE.

(forwarded by akpm@digeo.com)


 /dev/null                                 |  124 ------------------------------
 25-akpm/arch/arm/mm/fault-armv.c          |    4 
 25-akpm/arch/arm/mm/mm-armv.c             |    3 
 25-akpm/arch/ia64/ia32/binfmt_elf32.c     |    3 
 25-akpm/arch/ia64/mm/init.c               |    2 
 25-akpm/arch/parisc/kernel/cache.c        |    4 
 25-akpm/arch/ppc/mm/init.c                |   12 --
 25-akpm/arch/s390x/kernel/exec32.c        |    4 
 25-akpm/arch/sparc64/kernel/smp.c         |    8 -
 25-akpm/arch/sparc64/mm/init.c            |   12 +-
 25-akpm/arch/sparc64/mm/ultra.S           |    2 
 25-akpm/arch/x86_64/ia32/ia32_binfmt.c    |    5 -
 25-akpm/include/asm-alpha/pgtable.h       |    2 
 25-akpm/include/asm-arm/pgtable.h         |    2 
 25-akpm/include/asm-arm/proc-armv/cache.h |    4 
 25-akpm/include/asm-cris/pgtable.h        |    2 
 25-akpm/include/asm-ia64/pgtable.h        |    2 
 25-akpm/include/asm-m68k/pgtable.h        |    2 
 25-akpm/include/asm-m68knommu/pgtable.h   |    2 
 25-akpm/include/asm-mips/pgtable.h        |    2 
 25-akpm/include/asm-mips64/pgtable.h      |    2 
 25-akpm/include/asm-parisc/cacheflush.h   |    2 
 25-akpm/include/asm-parisc/pgtable.h      |    2 
 25-akpm/include/asm-ppc/pgtable.h         |    2 
 25-akpm/include/asm-ppc64/pgtable.h       |    2 
 25-akpm/include/asm-s390/pgtable.h        |    8 -
 25-akpm/include/asm-s390x/pgtable.h       |    8 -
 25-akpm/include/asm-sh/pgalloc.h          |    2 
 25-akpm/include/asm-sh/pgtable.h          |    2 
 25-akpm/include/asm-sparc/pgtable.h       |    2 
 25-akpm/include/asm-sparc64/pgtable.h     |    2 
 25-akpm/include/asm-um/pgtable.h          |   12 --
 25-akpm/include/asm-v850/pgtable.h        |    2 
 25-akpm/include/asm-x86_64/pgtable.h      |    2 
 34 files changed, 28 insertions(+), 223 deletions(-)

diff -puN arch/arm/mm/fault-armv.c~anobjrmap-6-arches arch/arm/mm/fault-armv.c
--- 25/arch/arm/mm/fault-armv.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/arm/mm/fault-armv.c	Thu Mar 20 17:46:19 2003
@@ -188,7 +188,7 @@ void __flush_dcache_page(struct page *pa
 
 	cpu_cache_clean_invalidate_range(kaddr, kaddr + PAGE_SIZE, 0);
 
-	if (!page->mapping)
+	if (!page_mapping(page))
 		return;
 
 	/*
@@ -289,7 +289,7 @@ void update_mmu_cache(struct vm_area_str
 	if (!pfn_valid(pfn))
 		return;
 	page = pfn_to_page(pfn);
-	if (page->mapping) {
+	if (page_mapping(page)) {
 		int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
 		unsigned long kaddr = (unsigned long)page_address(page);
 
diff -puN arch/arm/mm/mm-armv.c~anobjrmap-6-arches arch/arm/mm/mm-armv.c
--- 25/arch/arm/mm/mm-armv.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/arm/mm/mm-armv.c	Thu Mar 20 17:46:19 2003
@@ -17,7 +17,6 @@
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
 #include <asm/page.h>
-#include <asm/rmap.h>
 #include <asm/io.h>
 #include <asm/setup.h>
 #include <asm/tlbflush.h>
@@ -151,7 +150,7 @@ void free_pgd_slow(pgd_t *pgd)
 
 	pte = pmd_page(*pmd);
 	pmd_clear(pmd);
-	pgtable_remove_rmap(pte);
+	dec_page_state(nr_page_table_pages);
 	pte_free(pte);
 	pmd_free(pmd);
 free:
diff -puN arch/ia64/ia32/binfmt_elf32.c~anobjrmap-6-arches arch/ia64/ia32/binfmt_elf32.c
--- 25/arch/ia64/ia32/binfmt_elf32.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/ia64/ia32/binfmt_elf32.c	Thu Mar 20 17:46:19 2003
@@ -40,7 +40,6 @@
 #define CLOCKS_PER_SEC	IA32_CLOCKS_PER_SEC
 
 extern void ia64_elf32_init (struct pt_regs *regs);
-extern void put_dirty_page (struct task_struct * tsk, struct page *page, unsigned long address);
 
 static void elf32_set_personality (void);
 
@@ -200,7 +199,7 @@ ia32_setup_arg_pages (struct linux_binpr
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current, page, stack_base);
+			put_stack_page(mpnt, page, stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
diff -puN arch/ia64/mm/init.c~anobjrmap-6-arches arch/ia64/mm/init.c
--- 25/arch/ia64/mm/init.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/ia64/mm/init.c	Thu Mar 20 17:46:19 2003
@@ -223,7 +223,7 @@ show_mem(void)
 }
 
 /*
- * This is like put_dirty_page() but installs a clean page with PAGE_GATE protection
+ * This is like put_stack_page() but installs a clean page with PAGE_GATE protection
  * (execute-only, typically).
  */
 struct page *
diff -puN arch/parisc/kernel/cache.c~anobjrmap-6-arches arch/parisc/kernel/cache.c
--- 25/arch/parisc/kernel/cache.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/parisc/kernel/cache.c	Thu Mar 20 17:46:19 2003
@@ -64,7 +64,7 @@ update_mmu_cache(struct vm_area_struct *
 {
 	struct page *page = pte_page(pte);
 
-	if (VALID_PAGE(page) && page->mapping &&
+	if (VALID_PAGE(page) && page_mapping(page) &&
 	    test_bit(PG_dcache_dirty, &page->flags)) {
 
 		flush_kernel_dcache_page(page_address(page));
@@ -230,7 +230,7 @@ void __flush_dcache_page(struct page *pa
 
 	flush_kernel_dcache_page(page_address(page));
 
-	if (!page->mapping)
+	if (!page_mapping(page))
 		return;
 
 	list_for_each(l, &page->mapping->i_mmap_shared) {
diff -puN arch/ppc/mm/init.c~anobjrmap-6-arches arch/ppc/mm/init.c
--- 25/arch/ppc/mm/init.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/ppc/mm/init.c	Thu Mar 20 17:46:19 2003
@@ -472,18 +472,6 @@ void __init mem_init(void)
 		printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
 #endif /* defined(CONFIG_ALL_PPC) */
 
-	/* Make sure all our pagetable pages have page->mapping
-	   and page->index set correctly. */
-	for (addr = KERNELBASE; addr != 0; addr += PGDIR_SIZE) {
-		struct page *pg;
-		pmd_t *pmd = pmd_offset(pgd_offset_k(addr), addr);
-		if (pmd_present(*pmd)) {
-			pg = pmd_page(*pmd);
-			pg->mapping = (void *) &init_mm;
-			pg->index = addr;
-		}
-	}
-
 	mem_init_done = 1;
 }
 
diff -puN arch/s390x/kernel/exec32.c~anobjrmap-6-arches arch/s390x/kernel/exec32.c
--- 25/arch/s390x/kernel/exec32.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/s390x/kernel/exec32.c	Thu Mar 20 17:46:19 2003
@@ -33,8 +33,6 @@
 #endif
 
 
-extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address);
-
 #undef STACK_TOP
 #define STACK_TOP TASK31_SIZE
 
@@ -82,7 +80,7 @@ int setup_arg_pages32(struct linux_binpr
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current,page,stack_base);
+			put_stack_page(mpnt,page,stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
diff -puN arch/sparc64/kernel/smp.c~anobjrmap-6-arches arch/sparc64/kernel/smp.c
--- 25/arch/sparc64/kernel/smp.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/sparc64/kernel/smp.c	Thu Mar 20 17:46:19 2003
@@ -750,9 +750,9 @@ static __inline__ void __local_flush_dca
 #if (L1DCACHE_SIZE > PAGE_SIZE)
 	__flush_dcache_page(page->virtual,
 			    ((tlb_type == spitfire) &&
-			     page->mapping != NULL));
+			     page_mapping(page) != NULL));
 #else
-	if (page->mapping != NULL &&
+	if (page_mapping(page) != NULL &&
 	    tlb_type == spitfire)
 		__flush_icache_page(__pa(page->virtual));
 #endif
@@ -773,7 +773,7 @@ void smp_flush_dcache_page_impl(struct p
 		if (tlb_type == spitfire) {
 			data0 =
 				((u64)&xcall_flush_dcache_page_spitfire);
-			if (page->mapping != NULL)
+			if (page_mapping(page) != NULL)
 				data0 |= ((u64)1 << 32);
 			spitfire_xcall_deliver(data0,
 					       __pa(page->virtual),
@@ -804,7 +804,7 @@ void flush_dcache_page_all(struct mm_str
 		goto flush_self;
 	if (tlb_type == spitfire) {
 		data0 = ((u64)&xcall_flush_dcache_page_spitfire);
-		if (page->mapping != NULL)
+		if (page_mapping(page) != NULL)
 			data0 |= ((u64)1 << 32);
 		spitfire_xcall_deliver(data0,
 				       __pa(page->virtual),
diff -puN arch/sparc64/mm/init.c~anobjrmap-6-arches arch/sparc64/mm/init.c
--- 25/arch/sparc64/mm/init.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/sparc64/mm/init.c	Thu Mar 20 17:46:19 2003
@@ -129,9 +129,9 @@ __inline__ void flush_dcache_page_impl(s
 #if (L1DCACHE_SIZE > PAGE_SIZE)
 	__flush_dcache_page(page->virtual,
 			    ((tlb_type == spitfire) &&
-			     page->mapping != NULL));
+			     page_mapping(page) != NULL));
 #else
-	if (page->mapping != NULL &&
+	if (page_mapping(page) != NULL &&
 	    tlb_type == spitfire)
 		__flush_icache_page(__pa(page->virtual));
 #endif
@@ -193,7 +193,7 @@ void update_mmu_cache(struct vm_area_str
 
 	pfn = pte_pfn(pte);
 	if (pfn_valid(pfn) &&
-	    (page = pfn_to_page(pfn), page->mapping) &&
+	    (page = pfn_to_page(pfn), page_mapping(page)) &&
 	    ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) {
 		int cpu = ((pg_flags >> 24) & (NR_CPUS - 1UL));
 
@@ -217,7 +217,7 @@ void flush_dcache_page(struct page *page
 	int dirty = test_bit(PG_dcache_dirty, &page->flags);
 	int dirty_cpu = dcache_dirty_cpu(page);
 
-	if (page->mapping &&
+	if (page_mapping(page) &&
 	    list_empty(&page->mapping->i_mmap) &&
 	    list_empty(&page->mapping->i_mmap_shared)) {
 		if (dirty) {
@@ -227,7 +227,7 @@ void flush_dcache_page(struct page *page
 		}
 		set_dcache_dirty(page);
 	} else {
-		/* We could delay the flush for the !page->mapping
+		/* We could delay the flush for the !page_mapping
 		 * case too.  But that case is for exec env/arg
 		 * pages and those are %99 certainly going to get
 		 * faulted into the tlb (and thus flushed) anyways.
@@ -269,7 +269,7 @@ static inline void flush_cache_pte_range
 			if (!pfn_valid(pfn))
 				continue;
 			page = pfn_to_page(pfn);
-			if (PageReserved(page) || !page->mapping)
+			if (PageReserved(page) || !page_mapping(page))
 				continue;
 			pgaddr = (unsigned long) page_address(page);
 			uaddr = address + offset;
diff -puN arch/sparc64/mm/ultra.S~anobjrmap-6-arches arch/sparc64/mm/ultra.S
--- 25/arch/sparc64/mm/ultra.S~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/sparc64/mm/ultra.S	Thu Mar 20 17:46:19 2003
@@ -615,7 +615,7 @@ xcall_flush_dcache_page_cheetah: /* %g1 
 	.globl		xcall_flush_dcache_page_spitfire
 xcall_flush_dcache_page_spitfire: /* %g1 == physical page address
 				     %g7 == kernel page virtual address
-				     %g5 == (page->mapping != NULL)  */
+				     %g5 == (page_mapping != NULL)  */
 #if (L1DCACHE_SIZE > PAGE_SIZE)
 	srlx		%g1, (13 - 2), %g1	! Form tag comparitor
 	sethi		%hi(L1DCACHE_SIZE), %g3	! D$ size == 16K
diff -puN arch/x86_64/ia32/ia32_binfmt.c~anobjrmap-6-arches arch/x86_64/ia32/ia32_binfmt.c
--- 25/arch/x86_64/ia32/ia32_binfmt.c~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/arch/x86_64/ia32/ia32_binfmt.c	Thu Mar 20 17:46:19 2003
@@ -272,9 +272,6 @@ static void elf32_init(struct pt_regs *r
 	set_thread_flag(TIF_IA32); 
 }
 
-extern void put_dirty_page(struct task_struct * tsk, struct page *page, unsigned long address);
- 
-
 int setup_arg_pages(struct linux_binprm *bprm)
 {
 	unsigned long stack_base;
@@ -319,7 +316,7 @@ int setup_arg_pages(struct linux_binprm 
 		struct page *page = bprm->page[i];
 		if (page) {
 			bprm->page[i] = NULL;
-			put_dirty_page(current,page,stack_base);
+			put_stack_page(mpnt,page,stack_base);
 		}
 		stack_base += PAGE_SIZE;
 	}
diff -puN include/asm-alpha/pgtable.h~anobjrmap-6-arches include/asm-alpha/pgtable.h
--- 25/include/asm-alpha/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-alpha/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -343,6 +343,4 @@ extern void paging_init(void);
 /* We have our own get_unmapped_area to cope with ADDR_LIMIT_32BIT.  */
 #define HAVE_ARCH_UNMAPPED_AREA
 
-typedef pte_t *pte_addr_t;
-
 #endif /* _ALPHA_PGTABLE_H */
diff -puN -L include/asm-alpha/rmap.h include/asm-alpha/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-alpha/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _ALPHA_RMAP_H
-#define _ALPHA_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-arm/pgtable.h~anobjrmap-6-arches include/asm-arm/pgtable.h
--- 25/include/asm-arm/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-arm/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -162,8 +162,6 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD
 #define io_remap_page_range(vma,from,phys,size,prot) \
 		remap_page_range(vma,from,phys,size,prot)
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASMARM_PGTABLE_H */
diff -puN include/asm-arm/proc-armv/cache.h~anobjrmap-6-arches include/asm-arm/proc-armv/cache.h
--- 25/include/asm-arm/proc-armv/cache.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-arm/proc-armv/cache.h	Thu Mar 20 17:46:19 2003
@@ -81,7 +81,7 @@
  * flush_dcache_page is used when the kernel has written to the page
  * cache page at virtual address page->virtual.
  *
- * If this page isn't mapped (ie, page->mapping = NULL), or it has
+ * If this page isn't mapped (ie, page_mapping == NULL), or it has
  * userspace mappings (page->mapping->i_mmap or page->mapping->i_mmap_shared)
  * then we _must_ always clean + invalidate the dcache entries associated
  * with the kernel mapping.
@@ -97,7 +97,7 @@ extern void __flush_dcache_page(struct p
 
 static inline void flush_dcache_page(struct page *page)
 {
-	if (page->mapping && !mapping_mapped(page->mapping))
+	if (page_mapping(page) && !mapping_mapped(page->mapping))
 		set_bit(PG_dcache_dirty, &page->flags);
 	else
 		__flush_dcache_page(page);
diff -puN -L include/asm-arm/rmap.h include/asm-arm/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-arm/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,6 +0,0 @@
-#ifndef _ARM_RMAP_H
-#define _ARM_RMAP_H
-
-#include <asm-generic/rmap.h>
-
-#endif /* _ARM_RMAP_H */
diff -puN include/asm-cris/pgtable.h~anobjrmap-6-arches include/asm-cris/pgtable.h
--- 25/include/asm-cris/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-cris/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -515,6 +515,4 @@ static inline void update_mmu_cache(stru
  */
 #define pgtable_cache_init()   do { } while (0)
 
-typedef pte_t *pte_addr_t;
-
 #endif /* _CRIS_PGTABLE_H */
diff -puN -L include/asm-cris/rmap.h include/asm-cris/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-cris/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _CRIS_RMAP_H
-#define _CRIS_RMAP_H
-
-/* nothing to see, move along :) */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-ia64/pgtable.h~anobjrmap-6-arches include/asm-ia64/pgtable.h
--- 25/include/asm-ia64/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-ia64/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -420,8 +420,6 @@ extern unsigned long empty_zero_page[PAG
 /* We provide our own get_unmapped_area to cope with VA holes for userland */
 #define HAVE_ARCH_UNMAPPED_AREA
 
-typedef pte_t *pte_addr_t;
-
 # endif /* !__ASSEMBLY__ */
 
 /*
diff -puN -L include/asm-ia64/rmap.h include/asm-ia64/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-ia64/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _ASM_IA64_RMAP_H
-#define _ASM_IA64_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif /* _ASM_IA64_RMAP_H */
diff -puN include/asm-m68knommu/pgtable.h~anobjrmap-6-arches include/asm-m68knommu/pgtable.h
--- 25/include/asm-m68knommu/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-m68knommu/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -11,8 +11,6 @@
 #include <asm/page.h>
 #include <asm/io.h>
 
-typedef pte_t *pte_addr_t;
-
 /*
  * Trivial page table functions.
  */
diff -puN -L include/asm-m68knommu/rmap.h include/asm-m68knommu/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-m68knommu/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,2 +0,0 @@
-/* Do not need anything here */
-
diff -puN include/asm-m68k/pgtable.h~anobjrmap-6-arches include/asm-m68k/pgtable.h
--- 25/include/asm-m68k/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-m68k/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -172,8 +172,6 @@ extern inline void update_mmu_cache(stru
 #ifndef __ASSEMBLY__
 #include <asm-generic/pgtable.h>
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 /*
diff -puN -L include/asm-m68k/rmap.h include/asm-m68k/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-m68k/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _M68K_RMAP_H
-#define _M68K_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-mips64/pgtable.h~anobjrmap-6-arches include/asm-mips64/pgtable.h
--- 25/include/asm-mips64/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-mips64/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -811,8 +811,6 @@ extern inline void set_context(unsigned 
 
 #include <asm-generic/pgtable.h>
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !defined (_LANGUAGE_ASSEMBLY) */
 
 /*
diff -puN -L include/asm-mips64/rmap.h include/asm-mips64/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-mips64/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _MIPS64_RMAP_H
-#define _MIPS64_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-mips/pgtable.h~anobjrmap-6-arches include/asm-mips/pgtable.h
--- 25/include/asm-mips/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-mips/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -771,8 +771,6 @@ extern inline void set_context(unsigned 
 
 #include <asm-generic/pgtable.h>
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !defined (_LANGUAGE_ASSEMBLY) */
 
 #define io_remap_page_range remap_page_range
diff -puN -L include/asm-mips/rmap.h include/asm-mips/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-mips/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _MIPS_RMAP_H
-#define _MIPS_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-parisc/cacheflush.h~anobjrmap-6-arches include/asm-parisc/cacheflush.h
--- 25/include/asm-parisc/cacheflush.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-parisc/cacheflush.h	Thu Mar 20 17:46:19 2003
@@ -71,7 +71,7 @@ extern void __flush_dcache_page(struct p
 
 static inline void flush_dcache_page(struct page *page)
 {
-	if (page->mapping && list_empty(&page->mapping->i_mmap) &&
+	if (page_mapping(page) && list_empty(&page->mapping->i_mmap) &&
 			list_empty(&page->mapping->i_mmap_shared)) {
 		set_bit(PG_dcache_dirty, &page->flags);
 	} else {
diff -puN include/asm-parisc/pgtable.h~anobjrmap-6-arches include/asm-parisc/pgtable.h
--- 25/include/asm-parisc/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-parisc/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -434,8 +434,6 @@ static inline void ptep_mkdirty(pte_t *p
 
 #define pte_same(A,B)	(pte_val(A) == pte_val(B))
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #define io_remap_page_range remap_page_range
diff -puN -L include/asm-parisc/rmap.h include/asm-parisc/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-parisc/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _PARISC_RMAP_H
-#define _PARISC_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-ppc64/pgtable.h~anobjrmap-6-arches include/asm-ppc64/pgtable.h
--- 25/include/asm-ppc64/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-ppc64/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -375,7 +375,5 @@ extern void update_mmu_cache(struct vm_a
 extern void hpte_init_pSeries(void);
 extern void hpte_init_iSeries(void);
 
-typedef pte_t *pte_addr_t;
-
 #endif /* __ASSEMBLY__ */
 #endif /* _PPC64_PGTABLE_H */
diff -puN -L include/asm-ppc64/rmap.h include/asm-ppc64/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-ppc64/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,9 +0,0 @@
-#ifndef _PPC64_RMAP_H
-#define _PPC64_RMAP_H
-
-/* PPC64 calls pte_alloc() before mem_map[] is setup ... */
-#define BROKEN_PPC_PTE_ALLOC_ONE
-
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-ppc/pgtable.h~anobjrmap-6-arches include/asm-ppc/pgtable.h
--- 25/include/asm-ppc/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-ppc/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -570,8 +570,6 @@ extern void kernel_set_cachemode (unsign
  */
 #define pgtable_cache_init()	do { } while (0)
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 #endif /* _PPC_PGTABLE_H */
 #endif /* __KERNEL__ */
diff -puN -L include/asm-ppc/rmap.h include/asm-ppc/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-ppc/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,9 +0,0 @@
-#ifndef _PPC_RMAP_H
-#define _PPC_RMAP_H
-
-/* PPC calls pte_alloc() before mem_map[] is setup ... */
-#define BROKEN_PPC_PTE_ALLOC_ONE
-
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-s390/pgtable.h~anobjrmap-6-arches include/asm-s390/pgtable.h
--- 25/include/asm-s390/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-s390/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -422,8 +422,7 @@ static inline pte_t mk_pte_phys(unsigned
 	pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
 	                                                                  \
 	if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) {			  \
-		int __users = !!PagePrivate(__page) + !!__page->mapping;  \
-		if (__users + page_count(__page) == 1)                    \
+		if (page_count(__page) == 1)                              \
 			pte_val(__pte) |= _PAGE_MKCLEAN;                  \
 	}								  \
 	__pte;                                                            \
@@ -437,8 +436,7 @@ static inline pte_t mk_pte_phys(unsigned
 	pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
 	                                                                  \
 	if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) {			  \
-		int __users = !!PagePrivate(__page) + !!__page->mapping;  \
-		if (__users + page_count(__page) == 1)                    \
+		if (page_count(__page) == 1)                              \
 			pte_val(__pte) |= _PAGE_MKCLEAN;                  \
 	}								  \
 	__pte;                                                            \
@@ -507,8 +505,6 @@ extern inline pte_t mk_swap_pte(unsigned
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val })
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #define kern_addr_valid(addr)   (1)
diff -puN -L include/asm-s390/rmap.h include/asm-s390/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-s390/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _S390_RMAP_H
-#define _S390_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-s390x/pgtable.h~anobjrmap-6-arches include/asm-s390x/pgtable.h
--- 25/include/asm-s390x/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-s390x/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -441,8 +441,7 @@ extern inline pte_t mk_pte_phys(unsigned
 	pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
  	                                                                  \
 	if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) {			  \
-		int __users = !!PagePrivate(__page) + !!__page->mapping;  \
-		if (__users + page_count(__page) == 1)                    \
+		if (page_count(__page) == 1)                              \
 			pte_val(__pte) |= _PAGE_MKCLEAN;                  \
 	}								  \
 	__pte;                                                            \
@@ -456,8 +455,7 @@ extern inline pte_t mk_pte_phys(unsigned
 	pte_t __pte = mk_pte_phys(__physpage, __pgprot);                  \
 	                                                                  \
 	if (!(pgprot_val(__pgprot) & _PAGE_ISCLEAN)) {			  \
-		int __users = !!PagePrivate(__page) + !!__page->mapping;  \
-		if (__users + page_count(__page) == 1)                    \
+		if (page_count(__page) == 1)                              \
 			pte_val(__pte) |= _PAGE_MKCLEAN;                  \
 	}								  \
 	__pte;                                                            \
@@ -533,8 +531,6 @@ extern inline pte_t mk_swap_pte(unsigned
 #define __pte_to_swp_entry(pte)	((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)	((pte_t) { (x).val })
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #define kern_addr_valid(addr)   (1)
diff -puN -L include/asm-s390x/rmap.h include/asm-s390x/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-s390x/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _S390X_RMAP_H
-#define _S390X_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-sh/pgalloc.h~anobjrmap-6-arches include/asm-sh/pgalloc.h
--- 25/include/asm-sh/pgalloc.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-sh/pgalloc.h	Thu Mar 20 17:46:19 2003
@@ -109,7 +109,7 @@ static inline pte_t ptep_get_and_clear(p
 		unsigned long pfn = pte_pfn(pte);
 		if (pfn_valid(pfn)) {
 			page = pfn_to_page(page);
-			if (!page->mapping || !page->mapping->i_mmap_shared)
+			if (!page_mapping(page) || list_empty(&page->mapping->i_mmap_shared))
 				__clear_bit(PG_mapped, &page->flags);
 		}
 	}
diff -puN include/asm-sh/pgtable.h~anobjrmap-6-arches include/asm-sh/pgtable.h
--- 25/include/asm-sh/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-sh/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -307,8 +307,6 @@ extern void update_mmu_cache(struct vm_a
 
 #define pte_same(A,B)	(pte_val(A) == pte_val(B))
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #define kern_addr_valid(addr)	(1)
diff -puN -L include/asm-sh/rmap.h include/asm-sh/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-sh/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _SH_RMAP_H
-#define _SH_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-sparc64/pgtable.h~anobjrmap-6-arches include/asm-sparc64/pgtable.h
--- 25/include/asm-sparc64/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-sparc64/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -369,8 +369,6 @@ extern unsigned long get_fb_unmapped_are
 
 extern void check_pgt_cache(void);
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !(__ASSEMBLY__) */
 
 #endif /* !(_SPARC64_PGTABLE_H) */
diff -puN -L include/asm-sparc64/rmap.h include/asm-sparc64/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-sparc64/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _SPARC64_RMAP_H
-#define _SPARC64_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-sparc/pgtable.h~anobjrmap-6-arches include/asm-sparc/pgtable.h
--- 25/include/asm-sparc/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-sparc/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -442,8 +442,6 @@ extern int io_remap_page_range(struct vm
 
 #include <asm-generic/pgtable.h>
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !(__ASSEMBLY__) */
 
 /* We provide our own get_unmapped_area to cope with VA holes for userland */
diff -puN -L include/asm-sparc/rmap.h include/asm-sparc/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-sparc/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _SPARC_RMAP_H
-#define _SPARC_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif
diff -puN include/asm-um/pgtable.h~anobjrmap-6-arches include/asm-um/pgtable.h
--- 25/include/asm-um/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-um/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -385,18 +385,6 @@ static inline pmd_t * pmd_offset(pgd_t *
 #define pte_unmap(pte) kunmap_atomic((pte), KM_PTE0)
 #define pte_unmap_nested(pte) kunmap_atomic((pte), KM_PTE1)
 
-#if defined(CONFIG_HIGHPTE) && defined(CONFIG_HIGHMEM4G)
-typedef u32 pte_addr_t;
-#endif
-
-#if defined(CONFIG_HIGHPTE) && defined(CONFIG_HIGHMEM64G)
-typedef u64 pte_addr_t;
-#endif
-
-#if !defined(CONFIG_HIGHPTE)
-typedef pte_t *pte_addr_t;
-#endif
-
 #define update_mmu_cache(vma,address,pte) do ; while (0)
 
 /* Encode and de-code a swap entry */
diff -puN -L include/asm-um/rmap.h include/asm-um/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-um/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,6 +0,0 @@
-#ifndef __UM_RMAP_H
-#define __UM_RMAP_H
-
-#include "asm/arch/rmap.h"
-
-#endif
diff -puN include/asm-v850/pgtable.h~anobjrmap-6-arches include/asm-v850/pgtable.h
--- 25/include/asm-v850/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-v850/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -5,8 +5,6 @@
 #include <asm/page.h>
 
 
-typedef pte_t *pte_addr_t;
-
 #define pgd_present(pgd)	(1) /* pages are always present on NO_MM */
 #define pgd_none(pgd)		(0)
 #define pgd_bad(pgd)		(0)
diff -puN -L include/asm-v850/rmap.h include/asm-v850/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-v850/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1 +0,0 @@
-/* Do not need anything here */
diff -puN include/asm-x86_64/pgtable.h~anobjrmap-6-arches include/asm-x86_64/pgtable.h
--- 25/include/asm-x86_64/pgtable.h~anobjrmap-6-arches	Thu Mar 20 17:46:19 2003
+++ 25-akpm/include/asm-x86_64/pgtable.h	Thu Mar 20 17:46:19 2003
@@ -380,8 +380,6 @@ extern inline pte_t pte_modify(pte_t pte
 #define __pte_to_swp_entry(pte)		((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val })
 
-typedef pte_t *pte_addr_t;
-
 #endif /* !__ASSEMBLY__ */
 
 #ifndef CONFIG_DISCONTIGMEM
diff -puN -L include/asm-x86_64/rmap.h include/asm-x86_64/rmap.h~anobjrmap-6-arches /dev/null
--- 25/include/asm-x86_64/rmap.h
+++ /dev/null	Thu Apr 11 07:25:15 2002
@@ -1,7 +0,0 @@
-#ifndef _X8664_RMAP_H
-#define _X8664_RMAP_H
-
-/* nothing to see, move along */
-#include <asm-generic/rmap.h>
-
-#endif

_
