diff options
author | Nick Piggin <npiggin@suse.de> | 2006-03-22 03:08:40 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-22 10:54:02 -0500 |
commit | 7835e98b2e3c66dba79cb0ff8ebb90a2fe030c29 (patch) | |
tree | 405a96eade34845dabe2f125b6c5eb095846869d /mm/page_alloc.c | |
parent | 70dc991d66cac40fdb07346dba2b5d862d732c34 (diff) |
[PATCH] remove set_page_count() outside mm/
set_page_count usage outside mm/ is limited to setting the refcount to 1.
Remove set_page_count from outside mm/, and replace those users with
init_page_count() and set_page_refcounted().
This allows more debug checking, and tighter control on how code is allowed
to play around with page->_count.
Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e197818a7cf6..7f65b5a63bb3 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -442,7 +442,7 @@ void fastcall __init __free_pages_bootmem(struct page *page, unsigned int order) | |||
442 | if (order == 0) { | 442 | if (order == 0) { |
443 | __ClearPageReserved(page); | 443 | __ClearPageReserved(page); |
444 | set_page_count(page, 0); | 444 | set_page_count(page, 0); |
445 | set_page_refs(page, 0); | 445 | set_page_refcounted(page); |
446 | __free_page(page); | 446 | __free_page(page); |
447 | } else { | 447 | } else { |
448 | int loop; | 448 | int loop; |
@@ -457,7 +457,7 @@ void fastcall __init __free_pages_bootmem(struct page *page, unsigned int order) | |||
457 | set_page_count(p, 0); | 457 | set_page_count(p, 0); |
458 | } | 458 | } |
459 | 459 | ||
460 | set_page_refs(page, order); | 460 | set_page_refcounted(page); |
461 | __free_pages(page, order); | 461 | __free_pages(page, order); |
462 | } | 462 | } |
463 | } | 463 | } |
@@ -525,7 +525,7 @@ static int prep_new_page(struct page *page, int order) | |||
525 | 1 << PG_referenced | 1 << PG_arch_1 | | 525 | 1 << PG_referenced | 1 << PG_arch_1 | |
526 | 1 << PG_checked | 1 << PG_mappedtodisk); | 526 | 1 << PG_checked | 1 << PG_mappedtodisk); |
527 | set_page_private(page, 0); | 527 | set_page_private(page, 0); |
528 | set_page_refs(page, order); | 528 | set_page_refcounted(page); |
529 | kernel_map_pages(page, 1 << order, 1); | 529 | kernel_map_pages(page, 1 << order, 1); |
530 | return 0; | 530 | return 0; |
531 | } | 531 | } |
@@ -755,10 +755,8 @@ void split_page(struct page *page, unsigned int order) | |||
755 | 755 | ||
756 | BUG_ON(PageCompound(page)); | 756 | BUG_ON(PageCompound(page)); |
757 | BUG_ON(!page_count(page)); | 757 | BUG_ON(!page_count(page)); |
758 | for (i = 1; i < (1 << order); i++) { | 758 | for (i = 1; i < (1 << order); i++) |
759 | BUG_ON(page_count(page + i)); | 759 | set_page_refcounted(page + i); |
760 | set_page_count(page + i, 1); | ||
761 | } | ||
762 | } | 760 | } |
763 | 761 | ||
764 | /* | 762 | /* |
@@ -1771,7 +1769,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, | |||
1771 | continue; | 1769 | continue; |
1772 | page = pfn_to_page(pfn); | 1770 | page = pfn_to_page(pfn); |
1773 | set_page_links(page, zone, nid, pfn); | 1771 | set_page_links(page, zone, nid, pfn); |
1774 | set_page_count(page, 1); | 1772 | init_page_count(page); |
1775 | reset_page_mapcount(page); | 1773 | reset_page_mapcount(page); |
1776 | SetPageReserved(page); | 1774 | SetPageReserved(page); |
1777 | INIT_LIST_HEAD(&page->lru); | 1775 | INIT_LIST_HEAD(&page->lru); |