During hugepage unmap, TLB flush is currently issued at every PAGE_SIZE'd boundary which is unnecessary. We now issue the flush at REAL_HPAGE_SIZE boundaries only. Without this patch workloads which unmap a large hugepage backed VMA region get CPU lockups due to excessive TLB flush calls. Signed-off-by: Nitin Gupta <nitin.m.gupta@xxxxxxxxxx> --- arch/sparc/mm/hugetlbpage.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c index 131eaf4..48927cb 100644 --- a/arch/sparc/mm/hugetlbpage.c +++ b/arch/sparc/mm/hugetlbpage.c @@ -193,16 +193,24 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { pte_t entry; - int i; + int i, pte_count; entry = *ptep; if (pte_present(entry)) mm->context.huge_pte_count--; addr &= HPAGE_MASK; + pte_count = 1 << HUGETLB_PAGE_ORDER; - for (i = 0; i < (1 << HUGETLB_PAGE_ORDER); i++) { - pte_clear(mm, addr, ptep); + /* + * pte_clear issues TLB flush which is required + * only for REAL_HPAGE_SIZE aligned addresses. + */ + pte_clear(mm, addr, ptep); + pte_clear(mm, addr + REAL_HPAGE_SIZE, ptep + pte_count / 2); + ptep++; + for (i = 1; i < pte_count; i++) { + *ptep = __pte(0UL); addr += PAGE_SIZE; ptep++; } -- 2.6.4 -- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html