All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc64: Reduce TLB flushes during hugepage unmap
@ 2016-02-02  3:21 Nitin Gupta
  2016-02-02 21:25 ` David Miller
  2016-02-03 23:10 ` Nitin Gupta
  0 siblings, 2 replies; 3+ messages in thread
From: Nitin Gupta @ 2016-02-02  3:21 UTC (permalink / raw)
  To: sparclinux

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@oracle.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-03 23:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-02  3:21 [PATCH] sparc64: Reduce TLB flushes during hugepage unmap Nitin Gupta
2016-02-02 21:25 ` David Miller
2016-02-03 23:10 ` Nitin Gupta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.