Commit b5fc1438 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Make users of page->count use the provided macros

I'm about to change the meaning (and name) of page->count.  Go through and fix
up all those places which are open-coding references to it.
parent 21adfc14
......@@ -121,20 +121,20 @@ __change_page_attr(struct page *page, pgprot_t prot)
pte_t standard = mk_pte(page, PAGE_KERNEL);
set_pte_atomic(kpte, mk_pte(page, prot));
if (pte_same(old,standard))
atomic_inc(&kpte_page->count);
get_page(kpte_page);
} else {
struct page *split = split_large_page(address, prot);
if (!split)
return -ENOMEM;
atomic_inc(&kpte_page->count);
get_page(kpte_page);
set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL));
}
} else if ((pte_val(*kpte) & _PAGE_PSE) == 0) {
set_pte_atomic(kpte, mk_pte(page, PAGE_KERNEL));
atomic_dec(&kpte_page->count);
__put_page(kpte_page);
}
if (cpu_has_pse && (atomic_read(&kpte_page->count) == 1)) {
if (cpu_has_pse && (page_count(kpte_page) == 1)) {
list_add(&kpte_page->lru, &df_list);
revert_page(kpte_page, address);
}
......
......@@ -238,7 +238,7 @@ void __init mem_init(void)
set_page_address(page, lowmem_page_address(page));
#endif
set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1);
set_page_count(page, 1);
__free_page(page);
totalhigh_pages++;
}
......
......@@ -458,7 +458,7 @@ void __init mem_init(void)
ClearPageReserved(page);
set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1);
set_page_count(page, 1);
__free_page(page);
totalhigh_pages++;
}
......
......@@ -388,7 +388,7 @@ void map_high_region(unsigned long start_pfn, unsigned long end_pfn)
ClearPageReserved(page);
set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1);
set_page_count(page, 1);
__free_page(page);
totalhigh_pages++;
}
......
......@@ -294,7 +294,7 @@ void setup_highmem(unsigned long len)
page = &map[i];
ClearPageReserved(page);
set_bit(PG_highmem, &page->flags);
atomic_set(&page->count, 1);
set_page_count(page, 1);
__free_page(page);
}
phys += cur;
......
......@@ -126,20 +126,20 @@ __change_page_attr(unsigned long address, struct page *page, pgprot_t prot)
set_pte(kpte, mk_pte(page, prot));
if (pte_same(old,standard))
atomic_inc(&kpte_page->count);
get_page(kpte_page);
} else {
struct page *split = split_large_page(address, prot);
if (!split)
return -ENOMEM;
atomic_inc(&kpte_page->count);
get_page(kpte_page);
set_pte(kpte,mk_pte(split, PAGE_KERNEL));
}
} else if ((kpte_flags & _PAGE_PSE) == 0) {
set_pte(kpte, mk_pte(page, PAGE_KERNEL));
atomic_dec(&kpte_page->count);
__put_page(kpte_page);
}
if (atomic_read(&kpte_page->count) == 1) {
if (page_count(kpte_page) == 1) {
save_page(address, kpte_page);
revert_page(kpte_page, address);
}
......
......@@ -67,7 +67,7 @@ static unsigned long DRM(ati_alloc_pcigart_table)( void )
page = virt_to_page( address );
for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) {
atomic_inc( &page->count );
get_page(page);
SetPageReserved( page );
}
......@@ -84,7 +84,7 @@ static void DRM(ati_free_pcigart_table)( unsigned long address )
page = virt_to_page( address );
for ( i = 0 ; i < ATI_PCIGART_TABLE_PAGES ; i++, page++ ) {
atomic_dec( &page->count );
__put_page(page);
ClearPageReserved( page );
}
......
......@@ -102,7 +102,7 @@ static __inline__ struct page *DRM(do_vm_nopage)(struct vm_area_struct *vma,
DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
baddr, __va(agpmem->memory->memory[offset]), offset,
atomic_read(&page->count));
page_count(page));
return page;
}
......
......@@ -1099,10 +1099,10 @@ sg_rb_correct4mmap(Sg_scatter_hold * rsv_schp, int startFinish)
page_ptr = sg_scatg2virt(sclp) + m;
page = virt_to_page(page_ptr);
if (startFinish)
atomic_inc(&page->count);
get_page(page);
else {
if (page_count(page) > 0)
atomic_dec(&page->count);
__put_page(page);
}
}
}
......@@ -1111,10 +1111,10 @@ sg_rb_correct4mmap(Sg_scatter_hold * rsv_schp, int startFinish)
page_ptr = (unsigned char *) rsv_schp->buffer + m;
page = virt_to_page(page_ptr);
if (startFinish)
atomic_inc(&page->count);
get_page(page);
else {
if (page_count(page) > 0)
atomic_dec(&page->count);
__put_page(page);
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment