Store huge page linux pte in mmu_context_t
authorBill Carson <bill4carson@gmail.com>
Mon, 13 Feb 2012 09:44:25 +0000 (17:44 +0800)
committerGrazvydas Ignotas <notasas@gmail.com>
Sat, 22 Sep 2012 21:40:02 +0000 (00:40 +0300)
Signed-off-by: Bill Carson <bill4carson@gmail.com>
arch/arm/include/asm/mmu.h
arch/arm/mm/pgd.c

index 1496565..b338265 100644 (file)
@@ -9,6 +9,10 @@ typedef struct {
        raw_spinlock_t id_lock;
 #endif
        unsigned int kvm_seq;
+#ifdef CONFIG_ARM_HUGETLB_SUPPORT
+       /* we place hugepage linux pte at mm_struct.context  */
+       pte_t *huge_linux_pte;
+#endif
 } mm_context_t;
 
 #ifdef CONFIG_CPU_HAS_ASID
index b2027c1..965ed00 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/mm.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
+#include <linux/slab.h>
 
 #include <asm/pgalloc.h>
 #include <asm/page.h>
@@ -67,6 +68,12 @@ pgd_t *pgd_alloc(struct mm_struct *mm)
                pte_unmap(new_pte);
        }
 
+#ifdef CONFIG_ARM_HUGETLB_SUPPORT
+       /* reset the hugepage linux pte pointer
+        * for new mm_struct when we do the fork
+        */
+       mm->context.huge_linux_pte = NULL;
+#endif
        return new_pgd;
 
 no_pte:
@@ -76,6 +83,11 @@ no_pmd:
 no_pud:
        free_pages((unsigned long)new_pgd, 2);
 no_pgd:
+#ifdef CONFIG_ARM_HUGETLB_SUPPORT
+       /* free huge linux pte table */
+       if (mm->context.huge_linux_pte != NULL)
+               kfree(mm->context.huge_linux_pte);
+#endif
        return NULL;
 }