Skip to contentSkip to conversation

Hugepages need clear_user_highpage() not clear_highpage()

PATCH David Gibson 2 participants 2 messages Feb 6, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

When hugepages are newly allocated to a file in mm/hugetlb.c, we clear them with a call to clear_highpage() on each of the subpages. We should be using clear_user_highpage(): on powerpc, at least, clear_highpage() doesn't correctly mark the page as icache dirty so if the page is executed shortly after it's possible to get strange results.

This is a bugfix and should go into 2.6.16.

mm/hugetlb.c +1 -1
Index: working-2.6/mm/hugetlb.c
===================================================================
@@ -107,7 +107,7 @@ struct page *alloc_huge_page(struct vm_a
 	set_page_count(page, 1);
 	page[1].mapping = (void *)free_huge_page;
 	for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); ++i)
-		clear_highpage(&page[i]);
+		clear_user_highpage(&page[i], addr);
 	return page;
 }
 
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#1 lore raw
Quoted 8 lines · David Gibson

When hugepages are newly allocated to a file in mm/hugetlb.c, we clear them with a call to clear_highpage() on each of the subpages. We should be using clear_user_highpage(): on powerpc, at least, clear_highpage() doesn't correctly mark the page as icache dirty so if the page is executed shortly after it's possible to get strange results.
This is a bugfix and should go into 2.6.16.

Not sure how this got past the usual crapfilters. Sorry about that.

-- wli