diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-08-08 22:17:26 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-08-08 22:17:26 +0000 |
commit | 984760dbf5e48f6224dfe9e26e03536b3d38b6cd (patch) | |
tree | a99674322e524c4c90009b3bdae5fab0eebf2094 /arch | |
parent | a7ce7d5e94c98ef5b867f61b2ebecd563f4b6ec9 (diff) |
Merge with Linux 2.4.0-test6-pre8.
Diffstat (limited to 'arch')
33 files changed, 123 insertions, 126 deletions
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c index 84b608f45..2ab7941b2 100644 --- a/arch/alpha/mm/init.c +++ b/arch/alpha/mm/init.c @@ -141,7 +141,7 @@ pte_t __bad_page(void) { memset((void *) EMPTY_PGE, 0, PAGE_SIZE); - return pte_mkdirty(mk_pte(mem_map + MAP_NR(EMPTY_PGE), PAGE_SHARED)); + return pte_mkdirty(mk_pte(virt_to_page(EMPTY_PGE), PAGE_SHARED)); } void @@ -325,8 +325,8 @@ free_initmem (void) addr = (unsigned long)(&__init_begin); for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map+MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); totalram_pages++; } @@ -339,8 +339,8 @@ void free_initrd_mem(unsigned long start, unsigned long end) { for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 589653111..72eaa2e47 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -534,8 +534,8 @@ void __init paging_init(struct meminfo *mi) memzero(zero_page, PAGE_SIZE); memzero(bad_page, PAGE_SIZE); - empty_zero_page = mem_map + MAP_NR(zero_page); - empty_bad_page = mem_map + MAP_NR(bad_page); + empty_zero_page = virt_to_page(zero_page); + empty_bad_page = virt_to_page(bad_page); empty_bad_pte_table = ((pte_t *)bad_table) + TABLE_OFFSET; } @@ -598,7 +598,7 @@ void __init mem_init(void) static inline void free_area(unsigned long addr, unsigned long end, char *s) { unsigned int size = (end - addr) >> 10; - struct page *page = mem_map + MAP_NR(addr); + struct page *page = virt_to_page(addr); for (; addr < end; addr += PAGE_SIZE, page ++) { ClearPageReserved(page); @@ -632,8 +632,8 @@ void free_initrd_mem(unsigned long start, unsigned long end) if (!keep_initrd) { for (addr = start; addr < end; addr += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map+MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); totalram_pages++; } diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c index 1edbc35fd..e656a25d2 100644 --- a/arch/arm/mm/mm-armv.c +++ b/arch/arm/mm/mm-armv.c @@ -417,8 +417,8 @@ static inline void free_memmap(unsigned long start, unsigned long end) start = __phys_to_virt(start); end = __phys_to_virt(end); - pg = PAGE_ALIGN((unsigned long)(mem_map + MAP_NR(start))); - pgend = ((unsigned long)(mem_map + MAP_NR(end))) & PAGE_MASK; + pg = PAGE_ALIGN((unsigned long)(virt_to_page(start))); + pgend = ((unsigned long)(virt_to_page(end))) & PAGE_MASK; start = __virt_to_phys(pg); end = __virt_to_phys(pgend); diff --git a/arch/arm/mm/small_page.c b/arch/arm/mm/small_page.c index 40c91ba32..27fb0f663 100644 --- a/arch/arm/mm/small_page.c +++ b/arch/arm/mm/small_page.c @@ -142,12 +142,10 @@ no_page: static void __free_small_page(unsigned long spage, struct order *order) { unsigned long flags; - unsigned long nr; struct page *page; - nr = MAP_NR(spage); - if (nr < max_mapnr) { - page = mem_map + nr; + page = virt_to_page(spage); + if (VALID_PAGE(page)) { /* * The container-page must be marked Reserved diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c index af72d1581..9ba2baa31 100644 --- a/arch/i386/mm/init.c +++ b/arch/i386/mm/init.c @@ -566,8 +566,6 @@ void __init mem_init(void) #ifdef CONFIG_HIGHMEM highmem_start_page = mem_map + highstart_pfn; - /* cache the highmem_mapnr */ - highmem_mapnr = highstart_pfn; max_mapnr = num_physpages = highend_pfn; #else max_mapnr = num_physpages = max_low_pfn; @@ -642,8 +640,8 @@ void free_initmem(void) addr = (unsigned long)(&__init_begin); for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map+MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); totalram_pages++; } @@ -656,8 +654,8 @@ void free_initrd_mem(unsigned long start, unsigned long end) if (start < end) printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c index cb4427672..ba5c2e7ba 100644 --- a/arch/i386/mm/ioremap.c +++ b/arch/i386/mm/ioremap.c @@ -121,15 +121,14 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag */ if (phys_addr < virt_to_phys(high_memory)) { char *t_addr, *t_end; - int i; + struct page *page; t_addr = __va(phys_addr); t_end = t_addr + (size - 1); - for(i = MAP_NR(t_addr); i < MAP_NR(t_end); i++) { - if(!PageReserved(mem_map + i)) + for(page = virt_to_page(t_addr); page < virt_to_page(t_end); page++) + if(!PageReserved(page)) return NULL; - } } /* diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c index 6c63e33a7..770ef6363 100644 --- a/arch/ia64/ia32/binfmt_elf32.c +++ b/arch/ia64/ia32/binfmt_elf32.c @@ -81,9 +81,9 @@ void ia64_elf32_init(struct pt_regs *regs) { int nr; - put_shared_page(current, mem_map + MAP_NR(ia32_gdt_table), IA32_PAGE_OFFSET); + put_shared_page(current, virt_to_page(ia32_gdt_table), IA32_PAGE_OFFSET); if (PAGE_SHIFT <= IA32_PAGE_SHIFT) - put_shared_page(current, mem_map + MAP_NR(ia32_tss), IA32_PAGE_OFFSET + PAGE_SIZE); + put_shared_page(current, virt_to_page(ia32_tss), IA32_PAGE_OFFSET + PAGE_SIZE); nr = smp_processor_id(); diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c index d911c91bf..8ddda7e11 100644 --- a/arch/ia64/mm/init.c +++ b/arch/ia64/mm/init.c @@ -173,8 +173,8 @@ free_initmem (void) addr = (unsigned long) &__init_begin; for (; addr < (unsigned long) &__init_end; addr += PAGE_SIZE) { - clear_bit(PG_reserved, &mem_map[MAP_NR(addr)].flags); - set_page_count(&mem_map[MAP_NR(addr)], 1); + clear_bit(PG_reserved, &virt_to_page(addr)->flags); + set_page_count(virt_to_page(addr), 1); free_page(addr); ++totalram_pages; } @@ -188,8 +188,8 @@ free_initrd_mem(unsigned long start, unsigned long end) if (start < end) printk ("Freeing initrd memory: %ldkB freed\n", (end - start) >> 10); for (; start < end; start += PAGE_SIZE) { - clear_bit(PG_reserved, &mem_map[MAP_NR(start)].flags); - set_page_count(&mem_map[MAP_NR(start)], 1); + clear_bit(PG_reserved, &virt_to_page(start)->flags); + set_page_count(virt_to_page(start), 1); free_page(start); ++totalram_pages; } @@ -372,7 +372,7 @@ count_reserved_pages (u64 start, u64 end, void *arg) unsigned long *count = arg; struct page *pg; - for (pg = mem_map + MAP_NR(start); pg < mem_map + MAP_NR(end); ++pg) + for (pg = virt_to_page(start); pg < virt_to_page(end); ++pg) if (PageReserved(pg)) ++num_reserved; *count += num_reserved; @@ -409,7 +409,7 @@ mem_init (void) datasize >> 10, initsize >> 10); /* install the gate page in the global page table: */ - put_gate_page(mem_map + MAP_NR(__start_gate_section), GATE_ADDR); + put_gate_page(virt_to_page(__start_gate_section), GATE_ADDR); #ifndef CONFIG_IA64_SOFTSDV_HACKS /* diff --git a/arch/m68k/atari/stram.c b/arch/m68k/atari/stram.c index 2b804b767..d0acdaaae 100644 --- a/arch/m68k/atari/stram.c +++ b/arch/m68k/atari/stram.c @@ -305,7 +305,7 @@ void __init atari_stram_reserve_pages(unsigned long start_mem) /* always reserve first page of ST-RAM, the first 2 kB are * supervisor-only! */ - set_bit( PG_reserved, &mem_map[MAP_NR(stram_start)].flags ); + set_bit( PG_reserved, &virt_to_page(stram_start)->flags ); #ifdef CONFIG_STRAM_SWAP if (!max_swap_size) { @@ -699,7 +699,7 @@ static inline void unswap_pte(struct vm_area_struct * vma, unsigned long if (pte_page(pte) != page) return; if (0 /* isswap */) - mem_map[MAP_NR(pte_page(pte))].offset = page; + virt_to_page(pte_page(pte))->offset = page; else /* We will be removing the swap cache in a moment, so... */ set_pte(dir, pte_mkdirty(pte)); @@ -716,7 +716,7 @@ static inline void unswap_pte(struct vm_area_struct * vma, unsigned long DPRINTK( "unswap_pte: replacing entry %08lx by new page %08lx", entry, page ); set_pte(dir, pte_mkdirty(__mk_pte(page,vma->vm_page_prot))); - atomic_inc(&mem_map[MAP_NR(page)].count); + atomic_inc(&virt_to_page(page)->count); ++vma->vm_mm->rss; } swap_free(entry); @@ -1291,7 +1291,7 @@ static int get_gfp_order( unsigned long size ) /* reserve a range of pages in mem_map[] */ static void reserve_region( unsigned long addr, unsigned long end ) { - mem_map_t *mapp = &mem_map[MAP_NR(addr)]; + mem_map_t *mapp = virt_to_page(addr); for( ; addr < end; addr += PAGE_SIZE, ++mapp ) set_bit( PG_reserved, &mapp->flags ); diff --git a/arch/m68k/mm/init.c b/arch/m68k/mm/init.c index 4e6b28265..612d51eda 100644 --- a/arch/m68k/mm/init.c +++ b/arch/m68k/mm/init.c @@ -153,10 +153,10 @@ void __init mem_init(void) #if 0 #ifndef CONFIG_SUN3 if (virt_to_phys ((void *)tmp) >= mach_max_dma_address) - clear_bit(PG_DMA, &mem_map[MAP_NR(tmp)].flags); + clear_bit(PG_DMA, &virt_to_page(tmp)->flags); #endif #endif - if (PageReserved(mem_map+MAP_NR(tmp))) { + if (PageReserved(virt_to_page(tmp))) { if (tmp >= (unsigned long)&_text && tmp < (unsigned long)&_etext) codepages++; @@ -168,7 +168,7 @@ void __init mem_init(void) continue; } #if 0 - set_page_count(mem_map+MAP_NR(tmp), 1); + set_page_count(virt_to_page(tmp), 1); #ifdef CONFIG_BLK_DEV_INITRD if (!initrd_start || (tmp < (initrd_start & PAGE_MASK) || tmp >= initrd_end)) @@ -202,8 +202,8 @@ void __init mem_init(void) void free_initrd_mem(unsigned long start, unsigned long end) { for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } diff --git a/arch/m68k/mm/memory.c b/arch/m68k/mm/memory.c index a0a5336ed..a3c4f38c5 100644 --- a/arch/m68k/mm/memory.c +++ b/arch/m68k/mm/memory.c @@ -93,7 +93,7 @@ pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset) typedef struct list_head ptable_desc; static LIST_HEAD(ptable_list); -#define PD_PTABLE(page) ((ptable_desc *)&mem_map[MAP_NR(page)]) +#define PD_PTABLE(page) ((ptable_desc *)virt_to_page(page)) #define PD_PAGE(ptable) (list_entry(ptable, struct page, list)) #define PD_MARKBITS(dp) (*(unsigned char *)&PD_PAGE(dp)->index) diff --git a/arch/m68k/mm/motorola.c b/arch/m68k/mm/motorola.c index 146dc7279..61cd918e7 100644 --- a/arch/m68k/mm/motorola.c +++ b/arch/m68k/mm/motorola.c @@ -293,8 +293,8 @@ void free_initmem(void) addr = (unsigned long)&__init_begin; for (; addr < (unsigned long)&__init_end; addr += PAGE_SIZE) { - mem_map[MAP_NR(addr)].flags &= ~(1 << PG_reserved); - set_page_count(mem_map+MAP_NR(addr), 1); + virt_to_page(addr)->flags &= ~(1 << PG_reserved); + set_page_count(virt_to_page(addr), 1); free_page(addr); } } diff --git a/arch/mips/arc/memory.c b/arch/mips/arc/memory.c index 49de2ffa9..7988cfc39 100644 --- a/arch/mips/arc/memory.c +++ b/arch/mips/arc/memory.c @@ -228,8 +228,8 @@ prom_free_prom_memory (void) addr = PAGE_OFFSET + p->base; while (addr < p->base + p->size) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map + MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); addr += PAGE_SIZE; freed += PAGE_SIZE; diff --git a/arch/mips/dec/prom/memory.c b/arch/mips/dec/prom/memory.c index 1025104ce..e54e78a25 100644 --- a/arch/mips/dec/prom/memory.c +++ b/arch/mips/dec/prom/memory.c @@ -149,8 +149,8 @@ void prom_free_prom_memory (void) addr = PAGE_SIZE; while (addr < end) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map + MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); addr += PAGE_SIZE; } diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c index b1fde5108..a6f448e05 100644 --- a/arch/mips/mm/init.c +++ b/arch/mips/mm/init.c @@ -120,7 +120,8 @@ unsigned long empty_zero_page, zero_page_mask; static inline unsigned long setup_zero_pages(void) { - unsigned long order, size, pg; + unsigned long order, size; + struct page *page; switch (mips_cputype) { case CPU_R4000SC: @@ -137,11 +138,11 @@ static inline unsigned long setup_zero_pages(void) if (!empty_zero_page) panic("Oh boy, that early out of memory?"); - pg = MAP_NR(empty_zero_page); - while (pg < MAP_NR(empty_zero_page) + (1 << order)) { - set_bit(PG_reserved, &mem_map[pg].flags); - set_page_count(mem_map + pg, 0); - pg++; + page = virt_to_page(empty_zero_page); + while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) { + set_bit(PG_reserved, &page->flags); + set_page_count(page, 0); + page++; } size = PAGE_SIZE << order; @@ -309,8 +310,8 @@ void __init mem_init(void) void free_initrd_mem(unsigned long start, unsigned long end) { for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } @@ -329,8 +330,8 @@ void free_initmem(void) addr = (unsigned long) &__init_begin; while (addr < (unsigned long) &__init_end) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map + MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); totalram_pages++; addr += PAGE_SIZE; diff --git a/arch/mips/mm/umap.c b/arch/mips/mm/umap.c index 003866ac4..465bec37b 100644 --- a/arch/mips/mm/umap.c +++ b/arch/mips/mm/umap.c @@ -115,10 +115,10 @@ void *vmalloc_uncached (unsigned long size) static inline void free_pte(pte_t page) { if (pte_present(page)) { - unsigned long nr = pte_pagenr(page); - if (nr >= max_mapnr || PageReserved(mem_map+nr)) + struct page *ptpage = pte_page(page); + if ((!VALID_PAGE(ptpage)) || PageReserved(ptpage)) return; - __free_page(pte_page(page)); + __free_page(ptpage); if (current->mm->rss <= 0) return; current->mm->rss--; diff --git a/arch/mips64/arc/memory.c b/arch/mips64/arc/memory.c index 1e88dd6c7..d2ef95869 100644 --- a/arch/mips64/arc/memory.c +++ b/arch/mips64/arc/memory.c @@ -233,8 +233,8 @@ prom_free_prom_memory (void) addr = PAGE_OFFSET + (unsigned long) (long) p->base; end = addr + (unsigned long) (long) p->size; while (addr < end) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map + MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); addr += PAGE_SIZE; freed += PAGE_SIZE; diff --git a/arch/mips64/mm/init.c b/arch/mips64/mm/init.c index 223ca3e5e..f1d95c702 100644 --- a/arch/mips64/mm/init.c +++ b/arch/mips64/mm/init.c @@ -215,7 +215,8 @@ unsigned long empty_zero_page, zero_page_mask; unsigned long setup_zero_pages(void) { - unsigned long order, size, pg; + unsigned long order, size; + struct page *page; switch (mips_cputype) { case CPU_R4000SC: @@ -232,11 +233,11 @@ unsigned long setup_zero_pages(void) if (!empty_zero_page) panic("Oh boy, that early out of memory?"); - pg = MAP_NR(empty_zero_page); - while (pg < MAP_NR(empty_zero_page) + (1 << order)) { - set_bit(PG_reserved, &mem_map[pg].flags); - set_page_count(mem_map + pg, 0); - pg++; + page = virt_to_page(empty_zero_page); + while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) { + set_bit(PG_reserved, &page->flags); + set_page_count(page, 0); + page++; } size = PAGE_SIZE << order; @@ -374,8 +375,8 @@ void __init mem_init(void) void free_initrd_mem(unsigned long start, unsigned long end) { for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } @@ -396,8 +397,8 @@ free_initmem(void) addr = (unsigned long)(&__init_begin); while (addr < (unsigned long)&__init_end) { page = PAGE_OFFSET | CPHYSADDR(addr); - ClearPageReserved(mem_map + MAP_NR(page)); - set_page_count(mem_map + MAP_NR(page), 1); + ClearPageReserved(virt_to_page(page)); + set_page_count(virt_to_page(page), 1); free_page(page); totalram_pages++; addr += PAGE_SIZE; diff --git a/arch/mips64/mm/umap.c b/arch/mips64/mm/umap.c index b8ae542cc..9b0e7db1e 100644 --- a/arch/mips64/mm/umap.c +++ b/arch/mips64/mm/umap.c @@ -109,10 +109,10 @@ void *vmalloc_uncached (unsigned long size) static inline void free_pte(pte_t page) { if (pte_present(page)) { - unsigned long nr = pte_pagenr(page); - if (nr >= max_mapnr || PageReserved(mem_map+nr)) + struct page *ptpage = pte_page(page); + if ((!VALID_PAGE(ptpage)) || PageReserved(ptpage)) return; - __free_page(pte_page(page)); + __free_page(ptpage); if (current->mm->rss <= 0) return; current->mm->rss--; diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c index 16c3bc694..67257c50b 100644 --- a/arch/ppc/mm/init.c +++ b/arch/ppc/mm/init.c @@ -797,8 +797,8 @@ void __init free_initmem(void) #define FREESEC(START,END,CNT) do { \ a = (unsigned long)(&START); \ for (; a < (unsigned long)(&END); a += PAGE_SIZE) { \ - clear_bit(PG_reserved, &mem_map[MAP_NR(a)].flags); \ - set_page_count(mem_map+MAP_NR(a), 1); \ + clear_bit(PG_reserved, &virt_to_page(a)->flags); \ + set_page_count(virt_to_page(a), 1); \ free_page(a); \ CNT++; \ } \ @@ -865,8 +865,8 @@ void __init free_initmem(void) void free_initrd_mem(unsigned long start, unsigned long end) { for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } @@ -1187,7 +1187,7 @@ void __init mem_init(void) make sure the ramdisk pages aren't reserved. */ if (initrd_start) { for (addr = initrd_start; addr < initrd_end; addr += PAGE_SIZE) - clear_bit(PG_reserved, &mem_map[MAP_NR(addr)].flags); + clear_bit(PG_reserved, &virt_to_page(addr)->flags); } #endif /* CONFIG_BLK_DEV_INITRD */ @@ -1196,17 +1196,17 @@ void __init mem_init(void) if ( rtas_data ) for (addr = rtas_data; addr < PAGE_ALIGN(rtas_data+rtas_size) ; addr += PAGE_SIZE) - SetPageReserved(mem_map + MAP_NR(addr)); + SetPageReserved(virt_to_page(addr)); #endif /* defined(CONFIG_ALL_PPC) */ if ( sysmap_size ) for (addr = (unsigned long)sysmap; addr < PAGE_ALIGN((unsigned long)sysmap+sysmap_size) ; addr += PAGE_SIZE) - SetPageReserved(mem_map + MAP_NR(addr)); + SetPageReserved(virt_to_page(addr)); for (addr = PAGE_OFFSET; addr < (unsigned long)end_of_DRAM; addr += PAGE_SIZE) { - if (!PageReserved(mem_map + MAP_NR(addr))) + if (!PageReserved(virt_to_page(addr))) continue; if (addr < (ulong) etext) codepages++; diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c index 4e30c015a..a45d02ed8 100644 --- a/arch/s390/mm/init.c +++ b/arch/s390/mm/init.c @@ -351,8 +351,8 @@ void free_initmem(void) addr = (unsigned long)(&__init_begin); for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map+MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); totalram_pages++; } @@ -366,8 +366,8 @@ void free_initrd_mem(unsigned long start, unsigned long end) if (start < end) printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); for (; start < end; start += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(start)); - set_page_count(mem_map+MAP_NR(start), 1); + ClearPageReserved(virt_to_page(start)); + set_page_count(virt_to_page(start), 1); free_page(start); totalram_pages++; } diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index f798ef968..5e0632a86 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -270,8 +270,8 @@ void free_initmem(void) addr = (unsigned long)(&__init_begin); for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(addr)); - set_page_count(mem_map+MAP_NR(addr), 1); + ClearPageReserved(virt_to_page(addr)); + set_page_count(virt_to_page(addr), 1); free_page(addr); totalram_pages++; } @@ -283,8 +283,8 @@ void free_initrd_mem(unsigned long start, unsigned long end) { unsigned long p; for (p = start; p < end; p += PAGE_SIZE) { - ClearPageReserved(mem_map + MAP_NR(p)); - set_page_count(mem_map+MAP_NR(p), 1); + ClearPageReserved(virt_to_page(p)); + set_page_count(virt_to_page(p), 1); free_page(p); totalram_pages++; } diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c index 1294ad31a..280392629 100644 --- a/arch/sparc/kernel/sun4d_smp.c +++ b/arch/sparc/kernel/sun4d_smp.c @@ -298,20 +298,20 @@ void __init smp4d_boot_cpus(void) } /* Free unneeded trap tables */ - ClearPageReserved(mem_map + MAP_NR(trapbase_cpu1)); - set_page_count(mem_map + MAP_NR(trapbase_cpu1), 1); + ClearPageReserved(virt_to_page(trapbase_cpu1)); + set_page_count(virt_to_page(trapbase_cpu1), 1); free_page((unsigned long)trapbase_cpu1); totalram_pages++; num_physpages++; - ClearPageReserved(mem_map + MAP_NR(trapbase_cpu2)); - set_page_count(mem_map + MAP_NR(trapbase_cpu2), 1); + ClearPageReserved(virt_to_page(trapbase_cpu2)); + set_page_count(virt_to_page(trapbase_cpu2), 1); free_page((unsigned long)trapbase_cpu2); totalram_pages++; num_physpages++; - ClearPageReserved(mem_map + MAP_NR(trapbase_cpu3)); - set_page_count(mem_map + MAP_NR(trapbase_cpu3), 1); + ClearPageReserved(virt_to_page(trapbase_cpu3)); + set_page_count(virt_to_page(trapbase_cpu3), 1); free_page((unsigned long)trapbase_cpu3); totalram_pages++; num_physpages++; diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c index 60c37373e..d6c126d00 100644 --- a/arch/sparc/kernel/sun4m_smp.c +++ b/arch/sparc/kernel/sun4m_smp.c @@ -279,22 +279,22 @@ void __init smp4m_boot_cpus(void) /* Free unneeded trap tables */ if (!(cpu_present_map & (1 << 1))) { - ClearPageReserved(mem_map + MAP_NR(trapbase_cpu1)); - set_page_count(mem_map + MAP_NR(trapbase_cpu1), 1); + ClearPageReserved(virt_to_page(trapbase_cpu1)); + set_page_count(virt_to_page(trapbase_cpu1), 1); free_page((unsigned long)trapbase_cpu1); totalram_pages++; num_physpages++; } if (!(cpu_present_map & (1 << 2))) { - ClearPageReserved(mem_map + MAP_NR(trapbase_cpu2)); - set_page_count(mem_map + MAP_NR(trapbase_cpu2), 1); + ClearPageReserved(virt_to_page(trapbase_cpu2)); + set_page_count(virt_to_page(trapbase_cpu2), 1); free_page((unsigned long)trapbase_cpu2); totalram_pages++; num_physpages++; } if (!(cpu_present_map & (1 << 3))) { - ClearPageReserved(mem_map + MAP_NR(trapbase_cpu3)); - set_page_count(mem_map + MAP_NR(trapbase_cpu3), 1); + ClearPageReserved(virt_to_page(trapbase_cpu3)); + set_page_count(virt_to_page(trapbase_cpu3), 1); free_page((unsigned long)trapbase_cpu3); totalram_pages++; num_physpages++; diff --git a/arch/sparc/mm/generic.c b/arch/sparc/mm/generic.c index 9e599fd9d..ad74d0ed2 100644 --- a/arch/sparc/mm/generic.c +++ b/arch/sparc/mm/generic.c @@ -18,14 +18,14 @@ static inline void forget_pte(pte_t page) if (pte_none(page)) return; if (pte_present(page)) { - unsigned long nr = pte_pagenr(page); - if (nr >= max_mapnr || PageReserved(mem_map+nr)) + struct page *ptpage = pte_page(page); + if ((!VALID_PAGE(ptpage)) || PageReserved(ptpage)) return; /* * free_page() used to be able to clear swap cache * entries. We may now have to do it manually. */ - free_page_and_swap_cache(mem_map+nr); + free_page_and_swap_cache(ptpage); return; } swap_free(pte_to_swp_entry(page)); diff --git a/arch/sparc/mm/init.c b/arch/sparc/mm/init.c index ced31b91f..3d42e0c63 100644 --- a/arch/sparc/mm/init.c +++ b/arch/sparc/mm/init.c @@ -369,8 +369,8 @@ void __init free_mem_map_range(struct page *first, struct page *last) prom_printf("[%p,%p] ", first, last); #endif while (first < last) { - ClearPageReserved(mem_map + MAP_NR(first)); - set_page_count(mem_map + MAP_NR(first), 1); + ClearPageReserved(virt_to_page(first)); + set_page_count(virt_to_page(first), 1); free_page((unsigned long)first); totalram_pages++; num_physpages++; @@ -542,7 +542,7 @@ void free_initmem (void) struct page *p; page = addr + phys_base; - p = mem_map + MAP_NR(page); + p = virt_to_page(page); ClearPageReserved(p); set_page_count(p, 1); @@ -559,7 +559,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) if (start < end) printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); for (; start < end; start += PAGE_SIZE) { - struct page *p = mem_map + MAP_NR(start); + struct page *p = virt_to_page(start); ClearPageReserved(p); set_page_count(p, 1); diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c index a370ea2d4..f395f06f5 100644 --- a/arch/sparc/mm/io-unit.c +++ b/arch/sparc/mm/io-unit.c @@ -190,7 +190,7 @@ static void iounit_map_dma_area(unsigned long va, __u32 addr, int len) pmdp = pmd_offset(pgdp, addr); ptep = pte_offset(pmdp, addr); - set_pte(ptep, pte_val(mk_pte(mem_map + MAP_NR(page), dvma_prot))); + set_pte(ptep, pte_val(mk_pte(virt_to_page(page), dvma_prot))); i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c index 5fde9a52a..e48128479 100644 --- a/arch/sparc/mm/iommu.c +++ b/arch/sparc/mm/iommu.c @@ -247,7 +247,7 @@ static void iommu_map_dma_area(unsigned long va, __u32 addr, int len) pmdp = pmd_offset(pgdp, addr); ptep = pte_offset(pmdp, addr); - set_pte(ptep, mk_pte(mem_map + MAP_NR(page), dvma_prot)); + set_pte(ptep, mk_pte(virt_to_page(page), dvma_prot)); if (ipte_cache != 0) { iopte_val(*iopte++) = MKIOPTE(__pa(page)); } else { diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c index c7f839f28..7e76841de 100644 --- a/arch/sparc/mm/srmmu.c +++ b/arch/sparc/mm/srmmu.c @@ -612,7 +612,7 @@ static void srmmu_free_task_struct(struct task_struct *tsk) static void srmmu_get_task_struct(struct task_struct *tsk) { - atomic_inc(&mem_map[MAP_NR(tsk)].count); + atomic_inc(&virt_to_page(tsk)->count); } /* tsunami.S */ @@ -2153,7 +2153,7 @@ void __init ld_mmu_srmmu(void) BTFIXUPSET_CALL(set_pte, srmmu_set_pte, BTFIXUPCALL_SWAPO0O1); BTFIXUPSET_CALL(switch_mm, srmmu_switch_mm, BTFIXUPCALL_NORM); - BTFIXUPSET_CALL(pte_pagenr, srmmu_pte_pagenr, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(sparc_pte_pagenr, srmmu_pte_pagenr, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(pmd_page, srmmu_pmd_page, BTFIXUPCALL_NORM); BTFIXUPSET_CALL(pgd_page, srmmu_pgd_page, BTFIXUPCALL_NORM); diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c index 55551c561..717269b68 100644 --- a/arch/sparc/mm/sun4c.c +++ b/arch/sparc/mm/sun4c.c @@ -1320,7 +1320,7 @@ static __u32 sun4c_get_scsi_one(char *bufptr, unsigned long len, struct sbus_bus unsigned long page; page = ((unsigned long)bufptr) & PAGE_MASK; - if (MAP_NR(page) > max_mapnr) { + if (!VALID_PAGE(virt_to_page(page))) { sun4c_flush_page(page); return (__u32)bufptr; /* already locked */ } @@ -2095,7 +2095,7 @@ static int sun4c_pmd_none(pmd_t pmd) { return !pmd_val(pmd); } static int sun4c_pmd_bad(pmd_t pmd) { return (((pmd_val(pmd) & ~PAGE_MASK) != PGD_TABLE) || - (MAP_NR(pmd_val(pmd)) > max_mapnr)); + (!VALID_PAGE(virt_to_page(pmd_val(pmd))))); } static int sun4c_pmd_present(pmd_t pmd) @@ -2650,7 +2650,7 @@ void __init ld_mmu_sun4c(void) BTFIXUPSET_CALL(set_pte, sun4c_set_pte, BTFIXUPCALL_STO1O0); - BTFIXUPSET_CALL(pte_pagenr, sun4c_pte_pagenr, BTFIXUPCALL_NORM); + BTFIXUPSET_CALL(sparc_pte_pagenr, sun4c_pte_pagenr, BTFIXUPCALL_NORM); #if PAGE_SHIFT <= 12 BTFIXUPSET_CALL(pmd_page, sun4c_pmd_page, BTFIXUPCALL_ANDNINT(PAGE_SIZE - 1)); #else diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c index 63da67c8e..cd4b3365c 100644 --- a/arch/sparc64/mm/fault.c +++ b/arch/sparc64/mm/fault.c @@ -110,7 +110,7 @@ static unsigned int get_user_insn(unsigned long tpc) if(!pte_present(pte)) goto out; - pa = phys_base + (pte_pagenr(pte) << PAGE_SHIFT); + pa = phys_base + (sparc64_pte_pagenr(pte) << PAGE_SHIFT); pa += (tpc & ~PAGE_MASK); /* Use phys bypass so we don't pollute dtlb/dcache. */ diff --git a/arch/sparc64/mm/generic.c b/arch/sparc64/mm/generic.c index 9a1ab1de3..c469c6062 100644 --- a/arch/sparc64/mm/generic.c +++ b/arch/sparc64/mm/generic.c @@ -18,14 +18,14 @@ static inline void forget_pte(pte_t page) if (pte_none(page)) return; if (pte_present(page)) { - unsigned long nr = pte_pagenr(page); - if (nr >= max_mapnr || PageReserved(mem_map+nr)) + struct page *ptpage = pte_page(page); + if ((!VALID_PAGE(ptpage)) || PageReserved(ptpage)) return; /* * free_page() used to be able to clear swap cache * entries. We may now have to do it manually. */ - free_page_and_swap_cache(mem_map+nr); + free_page_and_swap_cache(ptpage); return; } swap_free(pte_to_swp_entry(page)); diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c index d3c9e5036..63994c51d 100644 --- a/arch/sparc64/mm/init.c +++ b/arch/sparc64/mm/init.c @@ -1242,7 +1242,7 @@ void free_initmem (void) page = (addr + ((unsigned long) __va(phys_base)) - ((unsigned long) &empty_zero_page)); - p = mem_map + MAP_NR(page); + p = virt_to_page(page); ClearPageReserved(p); set_page_count(p, 1); @@ -1257,7 +1257,7 @@ void free_initrd_mem(unsigned long start, unsigned long end) if (start < end) printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); for (; start < end; start += PAGE_SIZE) { - struct page *p = mem_map + MAP_NR(start); + struct page *p = virt_to_page(start); ClearPageReserved(p); set_page_count(p, 1); |