diff options
author | David Howells <dhowells@redhat.com> | 2006-01-06 03:11:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:26 -0500 |
commit | a226f6c899799fe2c4919daa0767ac579c88f7bd (patch) | |
tree | 82863c401f344cae8ab518b174085a7071a0a325 /mm/page_alloc.c | |
parent | 008857c1a49ccffc31a54c3ea7e182833bd61304 (diff) |
[PATCH] FRV: Clean up bootmem allocator's page freeing algorithm
The attached patch cleans up the way the bootmem allocator frees pages.
A new function, __free_pages_bootmem(), is provided in mm/page_alloc.c that is
called from mm/bootmem.c to turn pages over to the main allocator. All the
bits of code to initialise pages (clearing PG_reserved and setting the page
count) are moved to here. The checks on page validity are removed, on the
assumption that the struct page arrays will have been prepared correctly.
Signed-off-by: David Howells <dhowells@redhat.com>
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 | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 925b0b985f79..cdad3249cf7f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -53,6 +53,8 @@ unsigned long totalram_pages __read_mostly; | |||
53 | unsigned long totalhigh_pages __read_mostly; | 53 | unsigned long totalhigh_pages __read_mostly; |
54 | long nr_swap_pages; | 54 | long nr_swap_pages; |
55 | 55 | ||
56 | static void fastcall free_hot_cold_page(struct page *page, int cold); | ||
57 | |||
56 | /* | 58 | /* |
57 | * results with 256, 32 in the lowmem_reserve sysctl: | 59 | * results with 256, 32 in the lowmem_reserve sysctl: |
58 | * 1G machine -> (16M dma, 800M-16M normal, 1G-800M high) | 60 | * 1G machine -> (16M dma, 800M-16M normal, 1G-800M high) |
@@ -432,6 +434,39 @@ void __free_pages_ok(struct page *page, unsigned int order) | |||
432 | local_irq_restore(flags); | 434 | local_irq_restore(flags); |
433 | } | 435 | } |
434 | 436 | ||
437 | /* | ||
438 | * permit the bootmem allocator to evade page validation on high-order frees | ||
439 | */ | ||
440 | void fastcall __init __free_pages_bootmem(struct page *page, unsigned int order) | ||
441 | { | ||
442 | if (order == 0) { | ||
443 | __ClearPageReserved(page); | ||
444 | set_page_count(page, 0); | ||
445 | |||
446 | free_hot_cold_page(page, 0); | ||
447 | } else { | ||
448 | LIST_HEAD(list); | ||
449 | int loop; | ||
450 | |||
451 | for (loop = 0; loop < BITS_PER_LONG; loop++) { | ||
452 | struct page *p = &page[loop]; | ||
453 | |||
454 | if (loop + 16 < BITS_PER_LONG) | ||
455 | prefetchw(p + 16); | ||
456 | __ClearPageReserved(p); | ||
457 | set_page_count(p, 0); | ||
458 | } | ||
459 | |||
460 | arch_free_page(page, order); | ||
461 | |||
462 | mod_page_state(pgfree, 1 << order); | ||
463 | |||
464 | list_add(&page->lru, &list); | ||
465 | kernel_map_pages(page, 1 << order, 0); | ||
466 | free_pages_bulk(page_zone(page), 1, &list, order); | ||
467 | } | ||
468 | } | ||
469 | |||
435 | 470 | ||
436 | /* | 471 | /* |
437 | * The order of subdivision here is critical for the IO subsystem. | 472 | * The order of subdivision here is critical for the IO subsystem. |
@@ -671,7 +706,6 @@ static void zone_statistics(struct zonelist *zonelist, struct zone *z) | |||
671 | /* | 706 | /* |
672 | * Free a 0-order page | 707 | * Free a 0-order page |
673 | */ | 708 | */ |
674 | static void FASTCALL(free_hot_cold_page(struct page *page, int cold)); | ||
675 | static void fastcall free_hot_cold_page(struct page *page, int cold) | 709 | static void fastcall free_hot_cold_page(struct page *page, int cold) |
676 | { | 710 | { |
677 | struct zone *zone = page_zone(page); | 711 | struct zone *zone = page_zone(page); |