powerpc/mm: Add missing pmd accessors
This patch add documentation and missing accessors. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
9e819963b4
commit
06743521d0
@@ -62,6 +62,9 @@ static unsigned nr_gpages;
|
||||
/*
|
||||
* We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have
|
||||
* 16GB hugepage pte in PGD and 16MB hugepage pte at PMD;
|
||||
*
|
||||
* Defined in such a way that we can optimize away code block at build time
|
||||
* if CONFIG_HUGETLB_PAGE=n.
|
||||
*/
|
||||
int pmd_huge(pmd_t pmd)
|
||||
{
|
||||
|
@@ -35,6 +35,7 @@
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/hugetlb.h>
|
||||
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/page.h>
|
||||
@@ -344,16 +345,31 @@ EXPORT_SYMBOL(iounmap);
|
||||
EXPORT_SYMBOL(__iounmap);
|
||||
EXPORT_SYMBOL(__iounmap_at);
|
||||
|
||||
#ifndef __PAGETABLE_PUD_FOLDED
|
||||
/* 4 level page table */
|
||||
struct page *pgd_page(pgd_t pgd)
|
||||
{
|
||||
if (pgd_huge(pgd))
|
||||
return pte_page(pgd_pte(pgd));
|
||||
return virt_to_page(pgd_page_vaddr(pgd));
|
||||
}
|
||||
#endif
|
||||
|
||||
struct page *pud_page(pud_t pud)
|
||||
{
|
||||
if (pud_huge(pud))
|
||||
return pte_page(pud_pte(pud));
|
||||
return virt_to_page(pud_page_vaddr(pud));
|
||||
}
|
||||
|
||||
/*
|
||||
* For hugepage we have pfn in the pmd, we use PTE_RPN_SHIFT bits for flags
|
||||
* For PTE page, we have a PTE_FRAG_SIZE (4K) aligned virtual address.
|
||||
*/
|
||||
struct page *pmd_page(pmd_t pmd)
|
||||
{
|
||||
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
||||
if (pmd_trans_huge(pmd))
|
||||
if (pmd_trans_huge(pmd) || pmd_huge(pmd))
|
||||
return pfn_to_page(pmd_pfn(pmd));
|
||||
#endif
|
||||
return virt_to_page(pmd_page_vaddr(pmd));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user