]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] hugetlbpage highmem fix
authorAndrew Morton <akpm@osdl.org>
Tue, 13 Apr 2004 02:21:45 +0000 (19:21 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Tue, 13 Apr 2004 02:21:45 +0000 (19:21 -0700)
From: Andy Whitcroft <apw@shadowen.org>

When clearing a large page allocation ensure we use a page clear function
which will correctly clear a ZONE_HIGHMEM page.

mm/hugetlb.c

index cb72a40c38b64876034bba69df73b26846f2db69..403ef15a66f0926ec0e790fcec8f38fa4f5bc346 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/mm.h>
 #include <linux/hugetlb.h>
 #include <linux/sysctl.h>
+#include <linux/highmem.h>
 
 const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL;
 static unsigned long nr_huge_pages, free_huge_pages;
@@ -66,6 +67,7 @@ void free_huge_page(struct page *page)
 struct page *alloc_huge_page(void)
 {
        struct page *page;
+       int i;
 
        spin_lock(&hugetlb_lock);
        page = dequeue_huge_page();
@@ -77,7 +79,8 @@ struct page *alloc_huge_page(void)
        spin_unlock(&hugetlb_lock);
        set_page_count(page, 1);
        page->lru.prev = (void *)free_huge_page;
-       memset(page_address(page), 0, HPAGE_SIZE);
+       for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
+               clear_highpage(&page[i]);
        return page;
 }