Skip to contentSkip to conversation

(not so much) Fun with THP

DISCUSSION Andrea Arcangeli 3 participants 3 messages Jan 25, 2011 – Jan 26, 2011 1 message not in the archive

Subsystems (5)
Memory management x86 MM core THP +1 more subsystems
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 2 lines · Chris Wilson

On the one F15 box I've dared enable THP with, it hasn't succeeded in booting (with or without KMS). First it OOMed during lvm:

Sorry, for x86_32 there was some issue, below is all you need, thanks!

arch/x86/include/asm/paravirt.h +2 -3
index 2071a8b..ebbc4d8 100644
@@ -558,13 +558,12 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
 static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr,
 			      pmd_t *pmdp, pmd_t pmd)
 {
-#if PAGETABLE_LEVELS >= 3
 	if (sizeof(pmdval_t) > sizeof(long))
 		/* 5 arg words */
 		pv_mmu_ops.set_pmd_at(mm, addr, pmdp, pmd);
 	else
-		PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp, pmd.pmd);
-#endif
+		PVOP_VCALL4(pv_mmu_ops.set_pmd_at, mm, addr, pmdp,
+			    native_pmd_val(pmd));
 }
 #endif
 
mm/Kconfig +1 -1
index 3ad483b..e9c0c61 100644
@@ -179,7 +179,7 @@ config SPLIT_PTLOCK_CPUS
 config COMPACTION
 	bool "Allow for memory compaction"
 	select MIGRATION
-	depends on EXPERIMENTAL && HUGETLB_PAGE && MMU
+	depends on MMU
 	help
 	  Allows the compaction of memory for the allocation of huge pages.
 
mm/huge_memory.c +2 -1
index 004c9c2..c4f634b 100644
@@ -1837,9 +1837,9 @@ static void collapse_huge_page(struct mm_struct *mm,
 	spin_lock(ptl);
 	isolated = __collapse_huge_page_isolate(vma, address, pte);
 	spin_unlock(ptl);
-	pte_unmap(pte);
 
 	if (unlikely(!isolated)) {
+		pte_unmap(pte);
 		spin_lock(&mm->page_table_lock);
 		BUG_ON(!pmd_none(*pmd));
 		set_pmd_at(mm, address, pmd, _pmd);
@@ -1856,6 +1856,7 @@ static void collapse_huge_page(struct mm_struct *mm,
 	anon_vma_unlock(vma->anon_vma);
 
 	__collapse_huge_page_copy(pte, new_page, vma, address, ptl);
+	pte_unmap(pte);
 	__SetPageUptodate(new_page);
 	pgtable = pmd_pgtable(_pmd);
 	VM_BUG_ON(page_count(pgtable) != 1);
#2 lore raw
Quoted 5 lines · Andrea Arcangeli
Quoted 2 lines · Chris Wilson

On the one F15 box I've dared enable THP with, it hasn't succeeded in booting (with or without KMS). First it OOMed during lvm:

Sorry, for x86_32 there was some issue, below is all you need, thanks!

Thank you, I was missing the paravirt patch.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#3 lore raw
Quoted 8 lines · Chris Wilson
Quoted 5 lines · Andrea Arcangeli
Quoted 2 lines · Chris Wilson

On the one F15 box I've dared enable THP with, it hasn't succeeded in booting (with or without KMS). First it OOMed during lvm:

Sorry, for x86_32 there was some issue, below is all you need, thanks!

Thank you, I was missing the paravirt patch.

Thanks Chris, Andrea,

That explains a bug I've had users seeing which I cannot reproduce (since I'm all on 64-bit...)

regards,
--Kyle