Skip to content

Commit 545b1ea

Browse files
Nick PigginLinus Torvalds
authored andcommitted
[PATCH] mm: cleanup bootmem
The bootmem code added to page_alloc.c duplicated some page freeing code that it really doesn't need to because it is not so performance critical. While we're here, make prefetching work properly by actually prefetching the page we're about to use before prefetching ahead to the next one (ie. get the most important transaction started first). Also prefetch just a single page ahead rather than leaving a gap of 16. Jack Steiner reported no problems with SGI's ia64 simulator. Signed-off-by: Nick Piggin <npiggin@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent 9d41415 commit 545b1ea

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

‎mm/page_alloc.c‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ unsigned long totalhigh_pages __read_mostly;
5555
long nr_swap_pages;
5656
int percpu_pagelist_fraction;
5757

58-
static void fastcall free_hot_cold_page(struct page *page, int cold);
5958
static void __free_pages_ok(struct page *page, unsigned int order);
6059

6160
/*
@@ -448,28 +447,23 @@ void fastcall __init __free_pages_bootmem(struct page *page, unsigned int order)
448447
if (order == 0) {
449448
__ClearPageReserved(page);
450449
set_page_count(page, 0);
451-
452-
free_hot_cold_page(page, 0);
450+
set_page_refs(page, 0);
451+
__free_page(page);
453452
} else {
454-
LIST_HEAD(list);
455453
int loop;
456454

455+
prefetchw(page);
457456
for (loop = 0; loop < BITS_PER_LONG; loop++) {
458457
struct page *p = &page[loop];
459458

460-
if (loop + 16 < BITS_PER_LONG)
461-
prefetchw(p + 16);
459+
if (loop + 1 < BITS_PER_LONG)
460+
prefetchw(p + 1);
462461
__ClearPageReserved(p);
463462
set_page_count(p, 0);
464463
}
465464

466-
arch_free_page(page, order);
467-
468-
mod_page_state(pgfree, 1 << order);
469-
470-
list_add(&page->lru, &list);
471-
kernel_map_pages(page, 1 << order, 0);
472-
free_pages_bulk(page_zone(page), 1, &list, order);
465+
set_page_refs(page, order);
466+
__free_pages(page, order);
473467
}
474468
}
475469

0 commit comments

Comments
 (0)