Skip to contentSkip to conversation

Bug fix for hugepages on ppc64

PPC64 David Gibson 1 participant 1 message Jan 20, 2004

lore
Share & tools
lore
#0 lore raw

Andrew, please apply.

Currently the flag indicating whether or not hugepages are allowed below 4GB is not correctly propagated across fork(), which can lead to oopses. The patch below fixes this.

include/asm-ppc64/mmu_context.h +3 -0
diff -urN ppc64-linux-2.5/include/asm-ppc64/mmu_context.h linux-gogogo/include/asm-ppc64/mmu_context.h
@@ -81,6 +81,8 @@
 {
 	long head;
 	unsigned long flags;
+	/* This does the right thing across a fork (I hope) */
+	unsigned long low_hpages = mm->context & CONTEXT_LOW_HPAGES;
 
 	spin_lock_irqsave(&mmu_context_queue.lock, flags);
 
@@ -91,6 +93,7 @@
 
 	head = mmu_context_queue.head;
 	mm->context = mmu_context_queue.elements[head];
+	mm->context |= low_hpages;
 
 	head = (head < LAST_USER_CONTEXT-1) ? head+1 : 0;
 	mmu_context_queue.head = head;
Signature · 4 lines
David Gibson			| For every complex problem there is a
david AT gibson.dropbear.id.au	| solution which is simple, neat and
				| wrong.
http://www.ozlabs.org/people/dgibson