From: Vijay Kumar Date: Sun, 2 Oct 2016 21:40:18 +0000 (-0600) Subject: sparc64:mm/hugetlb: Set correct huge_pte_count index for 8M hugepages X-Git-Tag: v4.1.12-92~30^2~17 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1fd9865361aa251db3900eaaa509398971585b77;p=users%2Fjedix%2Flinux-maple.git sparc64:mm/hugetlb: Set correct huge_pte_count index for 8M hugepages Both set_huge_pte_at(...) and huge_ptep_get_and_clear(...) call real_hugepage_size_to_pte_count_idx(hugepage_size) when adjusting huge_pte_count. For 8MB/4MB the huge_pte_count index computed is 1(one). This is incorrect because this index is for xl_hugepages. So the tsb grow code in the mm fault path does not grow the tsb for 8MB/4MB hugepages. Signed-off-by: Bob Picco Signed-off-by: Vijay Kumar Reviewed-by: Mike Kravetz Tested-by: Mike Kravetz Orabug: 24490586 (cherry picked from commit c928d6fccaa59bd4b6cffc904144fa67a4726ff6) Signed-off-by: Allen Pais --- diff --git a/arch/sparc/include/asm/mmu_64.h b/arch/sparc/include/asm/mmu_64.h index 4db2fa11e346b..8c09ef96ae8e9 100644 --- a/arch/sparc/include/asm/mmu_64.h +++ b/arch/sparc/include/asm/mmu_64.h @@ -134,17 +134,6 @@ static inline unsigned int hugepage_size_to_pte_count_idx( return pte_count_index; } -static inline unsigned int real_hugepage_size_to_pte_count_idx( - unsigned long real_hugepage_size) -{ - unsigned int pte_count_index = MM_PTES_HUGE; - - if (real_hugepage_size != REAL_HPAGE_SIZE) - pte_count_index = MM_PTES_XLHUGE; - - return pte_count_index; -} - void __init hv_establish_xl_hugepage_tsb_descriptor(unsigned short pgsz_idx, unsigned int pgsz_mask); diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c index cdb08177aaba5..361f431c07b86 100644 --- a/arch/sparc/mm/hugetlbpage.c +++ b/arch/sparc/mm/hugetlbpage.c @@ -532,7 +532,7 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, if (!pte_present(*ptep) && pte_present(entry)) { unsigned int pte_count_idx = - real_hugepage_size_to_pte_count_idx(hugepage_size); + hugepage_size_to_pte_count_idx(hugepage_size); mm->context.huge_pte_count[pte_count_idx]++; } @@ -559,7 +559,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, if (pte_present(entry)) { unsigned int pte_count_idx = - real_hugepage_size_to_pte_count_idx(hugepage_size); + hugepage_size_to_pte_count_idx(hugepage_size); mm->context.huge_pte_count[pte_count_idx]--; }