|
@@ -92,11 +92,22 @@ static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long address)
|
|
|
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long vmaddr)
|
|
|
{
|
|
|
unsigned long *table = crst_table_alloc(mm);
|
|
|
- if (table)
|
|
|
- crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
|
|
|
+
|
|
|
+ if (!table)
|
|
|
+ return NULL;
|
|
|
+ crst_table_init(table, _SEGMENT_ENTRY_EMPTY);
|
|
|
+ if (!pgtable_pmd_page_ctor(virt_to_page(table))) {
|
|
|
+ crst_table_free(mm, table);
|
|
|
+ return NULL;
|
|
|
+ }
|
|
|
return (pmd_t *) table;
|
|
|
}
|
|
|
-#define pmd_free(mm, pmd) crst_table_free(mm, (unsigned long *) pmd)
|
|
|
+
|
|
|
+static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
|
|
|
+{
|
|
|
+ pgtable_pmd_page_dtor(virt_to_page(pmd));
|
|
|
+ crst_table_free(mm, (unsigned long *) pmd);
|
|
|
+}
|
|
|
|
|
|
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pud_t *pud)
|
|
|
{
|