From patchwork Fri Feb 2 08:07:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13542369 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C394C4828E for ; Fri, 2 Feb 2024 08:09:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ocPM0LD/37nPGwfGZpFdpn3zKfOjKan6oudCxaKX7Eg=; b=Wfpv75P7tWHpQE gluOeFikgF/Eru4434TQuxPKrcKtVlrgBZ1djU7XXYrMuCleXT2+JnhQWMokm5nzN0ThWyuBb1hGQ doeP3izvgQ3s5j9KmQkoulc2az/klpEsTniweHMDcXZu3c7o1pSkSYCwoIbB+plgXzrQuvIdBaaUD 3nUaEF4PTgxsTuJA/1P3NYhqxlA0Yb5CSnFURJ/Do9YeKyr3Dlt5gIoovpJ/uncpVEwfkGijNqbNA /M9qsk3Afnx3dNqa1HXIrfsdgjVolbQPwaD/1a3Cy/PZSn7GQBgqxKWYqs1GcX+qHHYbFogPnH7hJ Bf9ky87g4zwCda4IwCCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVoba-0000000AfpR-43je; Fri, 02 Feb 2024 08:08:59 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rVobQ-0000000AfeI-04kX for linux-arm-kernel@lists.infradead.org; Fri, 02 Feb 2024 08:08:54 +0000 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 34710176C; Fri, 2 Feb 2024 00:09:29 -0800 (PST) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.26]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 489F23F5A1; Fri, 2 Feb 2024 00:08:43 -0800 (PST) From: Ryan Roberts To: Catalin Marinas , Will Deacon , Ard Biesheuvel , Marc Zyngier , James Morse , Andrey Ryabinin , Andrew Morton , Matthew Wilcox , Mark Rutland , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Barry Song <21cnbao@gmail.com>, Alistair Popple , Yang Shi , Nicholas Piggin , Christophe Leroy , "Aneesh Kumar K.V" , "Naveen N. Rao" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, x86@kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 08/25] mm: Remove pte_next_pfn() and replace with pte_advance_pfn() Date: Fri, 2 Feb 2024 08:07:39 +0000 Message-Id: <20240202080756.1453939-9-ryan.roberts@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240202080756.1453939-1-ryan.roberts@arm.com> References: <20240202080756.1453939-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_000848_462042_8136D092 X-CRM114-Status: GOOD ( 12.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that the architectures are converted over to pte_advance_pfn(), we can remove the pte_next_pfn() wrapper and convert the callers to call pte_advance_pfn(). Signed-off-by: Ryan Roberts --- include/linux/pgtable.h | 9 +-------- mm/memory.c | 4 ++-- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 815d92dcb96b..50f32cccbd92 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -212,19 +212,12 @@ static inline int pmd_dirty(pmd_t pmd) #define arch_flush_lazy_mmu_mode() do {} while (0) #endif - -#ifndef pte_next_pfn #ifndef pte_advance_pfn static inline pte_t pte_advance_pfn(pte_t pte, unsigned long nr) { return __pte(pte_val(pte) + (nr << PFN_PTE_SHIFT)); } #endif -static inline pte_t pte_next_pfn(pte_t pte) -{ - return pte_advance_pfn(pte, 1); -} -#endif #ifndef set_ptes /** @@ -256,7 +249,7 @@ static inline void set_ptes(struct mm_struct *mm, unsigned long addr, if (--nr == 0) break; ptep++; - pte = pte_next_pfn(pte); + pte = pte_advance_pfn(pte, 1); } arch_leave_lazy_mmu_mode(); } diff --git a/mm/memory.c b/mm/memory.c index 38a010c4d04d..65fbe4f886c1 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -988,7 +988,7 @@ static inline int folio_pte_batch(struct folio *folio, unsigned long addr, { unsigned long folio_end_pfn = folio_pfn(folio) + folio_nr_pages(folio); const pte_t *end_ptep = start_ptep + max_nr; - pte_t expected_pte = __pte_batch_clear_ignored(pte_next_pfn(pte), flags); + pte_t expected_pte = __pte_batch_clear_ignored(pte_advance_pfn(pte, 1), flags); pte_t *ptep = start_ptep + 1; bool writable; @@ -1017,7 +1017,7 @@ static inline int folio_pte_batch(struct folio *folio, unsigned long addr, if (any_writable) *any_writable |= writable; - expected_pte = pte_next_pfn(expected_pte); + expected_pte = pte_advance_pfn(expected_pte, 1); ptep++; }