From nobody Fri May 8 06:01:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F170CC433F5 for ; Tue, 10 May 2022 04:38:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236371AbiEJEmn (ORCPT ); Tue, 10 May 2022 00:42:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232590AbiEJEmj (ORCPT ); Tue, 10 May 2022 00:42:39 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D37E575214 for ; Mon, 9 May 2022 21:38:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4A28512FC; Mon, 9 May 2022 21:38:43 -0700 (PDT) Received: from a077893.arm.com (unknown [10.163.34.190]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 921D33F66F; Mon, 9 May 2022 21:38:33 -0700 (PDT) From: Anshuman Khandual To: linux-arm-kernel@lists.infradead.org Cc: steve.capper@arm.com, Anshuman Khandual , Catalin Marinas , Will Deacon , Mike Kravetz , linux-kernel@vger.kernel.org Subject: [PATCH] arm64/hugetlb: Drop TLB flush from get_clear_flush() Date: Tue, 10 May 2022 10:09:30 +0530 Message-Id: <20220510043930.2410985-1-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This drops now redundant TLB flush in get_clear_flush() which is no longer required after recent commit 697a1d44af8b ("tlb: hugetlb: Add more sizes to tlb_remove_huge_tlb_entry"). It also renames this function i.e dropping off '_flush' and replacing it with '__contig' as appropriate. Cc: Catalin Marinas Cc: Will Deacon Cc: Mike Kravetz Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- This applies on v5.18-rc6 arch/arm64/mm/hugetlbpage.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/arch/arm64/mm/hugetlbpage.c b/arch/arm64/mm/hugetlbpage.c index cbace1c9e137..749435b01a89 100644 --- a/arch/arm64/mm/hugetlbpage.c +++ b/arch/arm64/mm/hugetlbpage.c @@ -166,15 +166,14 @@ static inline int num_contig_ptes(unsigned long size,= size_t *pgsize) * * This helper performs the break step. */ -static pte_t get_clear_flush(struct mm_struct *mm, +static pte_t get_clear_contig(struct mm_struct *mm, unsigned long addr, pte_t *ptep, unsigned long pgsize, unsigned long ncontig) { pte_t orig_pte =3D huge_ptep_get(ptep); - bool valid =3D pte_valid(orig_pte); - unsigned long i, saddr =3D addr; + unsigned long i; =20 for (i =3D 0; i < ncontig; i++, addr +=3D pgsize, ptep++) { pte_t pte =3D ptep_get_and_clear(mm, addr, ptep); @@ -190,11 +189,6 @@ static pte_t get_clear_flush(struct mm_struct *mm, if (pte_young(pte)) orig_pte =3D pte_mkyoung(orig_pte); } - - if (valid) { - struct vm_area_struct vma =3D TLB_FLUSH_VMA(mm, 0); - flush_tlb_range(&vma, saddr, addr); - } return orig_pte; } =20 @@ -392,7 +386,7 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, =20 ncontig =3D find_num_contig(mm, addr, ptep, &pgsize); =20 - return get_clear_flush(mm, addr, ptep, pgsize, ncontig); + return get_clear_contig(mm, addr, ptep, pgsize, ncontig); } =20 /* @@ -443,7 +437,7 @@ int huge_ptep_set_access_flags(struct vm_area_struct *v= ma, if (!__cont_access_flags_changed(ptep, pte, ncontig)) return 0; =20 - orig_pte =3D get_clear_flush(vma->vm_mm, addr, ptep, pgsize, ncontig); + orig_pte =3D get_clear_contig(vma->vm_mm, addr, ptep, pgsize, ncontig); =20 /* Make sure we don't lose the dirty or young state */ if (pte_dirty(orig_pte)) @@ -476,7 +470,7 @@ void huge_ptep_set_wrprotect(struct mm_struct *mm, ncontig =3D find_num_contig(mm, addr, ptep, &pgsize); dpfn =3D pgsize >> PAGE_SHIFT; =20 - pte =3D get_clear_flush(mm, addr, ptep, pgsize, ncontig); + pte =3D get_clear_contig(mm, addr, ptep, pgsize, ncontig); pte =3D pte_wrprotect(pte); =20 hugeprot =3D pte_pgprot(pte); --=20 2.20.1