提交 1ae9ae5f 编写于 作者: K Kirill A. Shutemov 提交者: Linus Torvalds
上级 478cf8ca
...@@ -2519,12 +2519,13 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, ...@@ -2519,12 +2519,13 @@ pgtable_t pte_alloc_one(struct mm_struct *mm,
return pte; return pte;
page = __alloc_for_cache(mm); page = __alloc_for_cache(mm);
if (page) { if (!page)
pgtable_page_ctor(page); return NULL;
pte = (pte_t *) page_address(page); if (!pgtable_page_ctor(page)) {
free_hot_cold_page(page, 0);
return NULL;
} }
return (pte_t *) page_address(page);
return pte;
} }
void pte_free_kernel(struct mm_struct *mm, pte_t *pte) void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
......
...@@ -345,7 +345,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) ...@@ -345,7 +345,10 @@ pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address)
if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0) if ((pte = (unsigned long)pte_alloc_one_kernel(mm, address)) == 0)
return NULL; return NULL;
page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT); page = pfn_to_page(__nocache_pa(pte) >> PAGE_SHIFT);
pgtable_page_ctor(page); if (!pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}
return page; return page;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册