Skip to content

Commit

Permalink
mm/um: use free_highmem_page() to free highmem pages into buddy system
Browse files Browse the repository at this point in the history
Use helper function free_highmem_page() to free highmem pages into
the buddy system.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jiang Liu authored and Linus Torvalds committed Apr 29, 2013
1 parent 32e1a10 commit 5b472b2
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions arch/um/kernel/mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,12 @@ static unsigned long brk_end;
static void setup_highmem(unsigned long highmem_start,
unsigned long highmem_len)
{
struct page *page;
unsigned long highmem_pfn;
int i;

highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT;
for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) {
page = &mem_map[highmem_pfn + i];
ClearPageReserved(page);
init_page_count(page);
__free_page(page);
}
for (i = 0; i < highmem_len >> PAGE_SHIFT; i++)
free_highmem_page(&mem_map[highmem_pfn + i]);
}
#endif

Expand All @@ -73,18 +68,13 @@ void __init mem_init(void)
totalram_pages = free_all_bootmem();
max_low_pfn = totalram_pages;
#ifdef CONFIG_HIGHMEM
totalhigh_pages = highmem >> PAGE_SHIFT;
totalram_pages += totalhigh_pages;
setup_highmem(end_iomem, highmem);
#endif
num_physpages = totalram_pages;
max_pfn = totalram_pages;
printk(KERN_INFO "Memory: %luk available\n",
nr_free_pages() << (PAGE_SHIFT-10));
kmalloc_ok = 1;

#ifdef CONFIG_HIGHMEM
setup_highmem(end_iomem, highmem);
#endif
}

/*
Expand Down

0 comments on commit 5b472b2

Please sign in to comment.