Commit db12b88f authored by Andrew Morton's avatar Andrew Morton Committed by Russell King

[PATCH] hugetlb kmap fix

From Bill Irwin

This patch makes alloc_hugetlb_page() kmap() the memory it's zeroing,
and cleans up a tiny bit of list handling on the side.  Without this
fix, it oopses every time it's called.
parent 908325dc
...@@ -44,24 +44,22 @@ find_key_inode(int key) ...@@ -44,24 +44,22 @@ find_key_inode(int key)
static struct page * static struct page *
alloc_hugetlb_page(void) alloc_hugetlb_page(void)
{ {
struct list_head *curr, *head; int i;
struct page *page; struct page *page;
spin_lock(&htlbpage_lock); spin_lock(&htlbpage_lock);
if (list_empty(&htlbpage_freelist)) {
head = &htlbpage_freelist;
curr = head->next;
if (curr == head) {
spin_unlock(&htlbpage_lock); spin_unlock(&htlbpage_lock);
return NULL; return NULL;
} }
page = list_entry(curr, struct page, list);
list_del(curr); page = list_entry(htlbpage_freelist.next, struct page, list);
list_del(&page->list);
htlbpagemem--; htlbpagemem--;
spin_unlock(&htlbpage_lock); spin_unlock(&htlbpage_lock);
set_page_count(page, 1); set_page_count(page, 1);
memset(page_address(page), 0, HPAGE_SIZE); for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
clear_highpage(&page[i]);
return page; return page;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment