Re: [PATCHv5 11/11] x86, mm: enable split page table lock for PMD level

Steven Rostedt
2013-10-07T16:16:15Z

On Mon, Oct 07, 2013 at 04:54:13PM +0300, Kirill A. Shutemov wrote:
>
> config ARCH_HIBERNATION_HEADER
> diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h
> index b4389a468f..e2fb2b6934 100644
> --- a/arch/x86/include/asm/pgalloc.h
> +++ b/arch/x86/include/asm/pgalloc.h
> @@ -80,12 +80,21 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
> #if PAGETABLE_LEVELS > 2
> static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
> {
> - return (pmd_t *)get_zeroed_page(GFP_KERNEL|__GFP_REPEAT);
> + struct page *page;
> + page = alloc_pages(GFP_KERNEL | __GFP_REPEAT| __GFP_ZERO, 0);
> + if (!page)
> + return NULL;
> + if (!pgtable_pmd_page_ctor(page)) {
> + __free_pages(page, 0);
> + return NULL;

Thanks for thinking about us -rt folks :-)

Yeah, this is good, as we can't put the lock into the page table.

Consider this and the previous patch:

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

> + }
> + return (pmd_t *)page_address(page);
> }
>
> static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
> {
> BUG_ON((unsigned long)pmd & (PAGE_SIZE-1));
> + pgtable_pmd_page_dtor(virt_to_page(pmd));
> free_page((unsigned long)pmd);
> }
>
> --
> 1.8.4.rc3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/