Commit 441a6278 authored by Anshuman Khandual's avatar Anshuman Khandual Committed by Catalin Marinas

arm64/hugetlb: Use macros for contiguous huge page sizes

Replace all open encoded contiguous huge page size computations with
available macro encodings CONT_PTE_SIZE and CONT_PMD_SIZE. There are other
instances where these macros are used in the file and this change makes it
consistently use the same mnemonic.
Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Steve Capper <steve.capper@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
parent f2c7c76c
...@@ -228,7 +228,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, ...@@ -228,7 +228,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
if (sz == PUD_SIZE) { if (sz == PUD_SIZE) {
ptep = (pte_t *)pudp; ptep = (pte_t *)pudp;
} else if (sz == (PAGE_SIZE * CONT_PTES)) { } else if (sz == (CONT_PTE_SIZE)) {
pmdp = pmd_alloc(mm, pudp, addr); pmdp = pmd_alloc(mm, pudp, addr);
WARN_ON(addr & (sz - 1)); WARN_ON(addr & (sz - 1));
...@@ -246,7 +246,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, ...@@ -246,7 +246,7 @@ pte_t *huge_pte_alloc(struct mm_struct *mm,
ptep = huge_pmd_share(mm, addr, pudp); ptep = huge_pmd_share(mm, addr, pudp);
else else
ptep = (pte_t *)pmd_alloc(mm, pudp, addr); ptep = (pte_t *)pmd_alloc(mm, pudp, addr);
} else if (sz == (PMD_SIZE * CONT_PMDS)) { } else if (sz == (CONT_PMD_SIZE)) {
pmdp = pmd_alloc(mm, pudp, addr); pmdp = pmd_alloc(mm, pudp, addr);
WARN_ON(addr & (sz - 1)); WARN_ON(addr & (sz - 1));
return (pte_t *)pmdp; return (pte_t *)pmdp;
...@@ -454,9 +454,9 @@ static int __init hugetlbpage_init(void) ...@@ -454,9 +454,9 @@ static int __init hugetlbpage_init(void)
#ifdef CONFIG_ARM64_4K_PAGES #ifdef CONFIG_ARM64_4K_PAGES
add_huge_page_size(PUD_SIZE); add_huge_page_size(PUD_SIZE);
#endif #endif
add_huge_page_size(PMD_SIZE * CONT_PMDS); add_huge_page_size(CONT_PMD_SIZE);
add_huge_page_size(PMD_SIZE); add_huge_page_size(PMD_SIZE);
add_huge_page_size(PAGE_SIZE * CONT_PTES); add_huge_page_size(CONT_PTE_SIZE);
return 0; return 0;
} }
...@@ -470,9 +470,9 @@ static __init int setup_hugepagesz(char *opt) ...@@ -470,9 +470,9 @@ static __init int setup_hugepagesz(char *opt)
#ifdef CONFIG_ARM64_4K_PAGES #ifdef CONFIG_ARM64_4K_PAGES
case PUD_SIZE: case PUD_SIZE:
#endif #endif
case PMD_SIZE * CONT_PMDS: case CONT_PMD_SIZE:
case PMD_SIZE: case PMD_SIZE:
case PAGE_SIZE * CONT_PTES: case CONT_PTE_SIZE:
add_huge_page_size(ps); add_huge_page_size(ps);
return 1; return 1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment