Skip to content

Commit

Permalink
[PATCH] mm: arch_free_page fix
Browse files Browse the repository at this point in the history
After the PG_reserved check was added, arch_free_page was being called in the
wrong place (it could be called for a page we don't actually want to free).
Fix that.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Oct 11, 2006
1 parent 6993974 commit dafb136
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,6 @@ static void __free_pages_ok(struct page *page, unsigned int order)
int i;
int reserved = 0;

arch_free_page(page, order);
if (!PageHighMem(page))
debug_check_no_locks_freed(page_address(page),
PAGE_SIZE<<order);
Expand All @@ -505,7 +504,9 @@ static void __free_pages_ok(struct page *page, unsigned int order)
if (reserved)
return;

arch_free_page(page, order);
kernel_map_pages(page, 1 << order, 0);

local_irq_save(flags);
__count_vm_events(PGFREE, 1 << order);
free_one_page(page_zone(page), page, order);
Expand Down Expand Up @@ -781,13 +782,12 @@ static void fastcall free_hot_cold_page(struct page *page, int cold)
struct per_cpu_pages *pcp;
unsigned long flags;

arch_free_page(page, 0);

if (PageAnon(page))
page->mapping = NULL;
if (free_pages_check(page))
return;

arch_free_page(page, 0);
kernel_map_pages(page, 1, 0);

pcp = &zone_pcp(zone, get_cpu())->pcp[cold];
Expand Down

0 comments on commit dafb136

Please sign in to comment.