linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Kaihao Bai <carlo.bai@linux.alibaba.com>
To: catalin.marinas@arm.com, will@kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: anshuman.khandual@arm.com, baolin.wang@linux.alibaba.com,
	carlo.bai@linux.alibaba.com
Subject: [RFC PATCH 1/1] arm64: mm: remove unnecessary multiple tlb flush of contiguous hugetlb
Date: Tue,  7 Feb 2023 19:09:41 +0800	[thread overview]
Message-ID: <1675768181-41518-1-git-send-email-carlo.bai@linux.alibaba.com> (raw)

In arm64, contiguous flag refers to the same TLB entry that shared by a
contiguous address range. If flush one entry of the address range, it
would cover the whole contiguous address range. Thus there's no need to
flush all contiguous range that CONT_PMD/PTE points to.

Signed-off-by: Kaihao Bai <carlo.bai@linux.alibaba.com>
---
 arch/arm64/mm/hugetlbpage.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c
index 95364e8bdc19..9213072ce9c7 100644
--- a/arch/arm64/mm/hugetlbpage.c
+++ b/arch/arm64/mm/hugetlbpage.c
@@ -213,7 +213,7 @@ static pte_t get_clear_contig_flush(struct mm_struct *mm,
 	pte_t orig_pte = get_clear_contig(mm, addr, ptep, pgsize, ncontig);
 	struct vm_area_struct vma = TLB_FLUSH_VMA(mm, 0);
 
-	flush_tlb_range(&vma, addr, addr + (pgsize * ncontig));
+	flush_tlb_page(&vma, addr);
 	return orig_pte;
 }
 
@@ -238,7 +238,7 @@ static void clear_flush(struct mm_struct *mm,
 	for (i = 0; i < ncontig; i++, addr += pgsize, ptep++)
 		pte_clear(mm, addr, ptep);
 
-	flush_tlb_range(&vma, saddr, addr);
+	flush_tlb_page(&vma, saddr);
 }
 
 static inline struct folio *hugetlb_swap_entry_to_folio(swp_entry_t entry)
-- 
2.27.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2023-02-07 11:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 11:09 Kaihao Bai [this message]
2023-02-07 18:21 ` [RFC PATCH 1/1] arm64: mm: remove unnecessary multiple tlb flush of contiguous hugetlb Catalin Marinas
2023-02-08  3:43   ` Carlo Bai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1675768181-41518-1-git-send-email-carlo.bai@linux.alibaba.com \
    --to=carlo.bai@linux.alibaba.com \
    --cc=anshuman.khandual@arm.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).