diff mbox series

[1/2] arm64/mm/hotplug: Drop redundant [pgd|p4d]_present()

Message ID 20250221094449.1188427-2-anshuman.khandual@arm.com (mailing list archive)
State New
Headers show
Series arm64/mm/hotplug: Drop some redundant WARN_ON() | expand

Commit Message

Anshuman Khandual Feb. 21, 2025, 9:44 a.m. UTC
[pgd|p4d]_present() are inverse to their corresponding [pgd|p4d]_none(). So
[pgd|p4d]_present() test right after corresponding [pgd|p4d]_none() inverse
test does not make sense. Hence just drop these redundant checks.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/arm64/mm/mmu.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Dev Jain Feb. 21, 2025, 5:37 p.m. UTC | #1
On 21/02/25 3:14 pm, Anshuman Khandual wrote:
> [pgd|p4d]_present() are inverse to their corresponding [pgd|p4d]_none(). So
> [pgd|p4d]_present() test right after corresponding [pgd|p4d]_none() inverse
> test does not make sense. Hence just drop these redundant checks.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ryan Roberts <ryan.roberts@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

LGTM

Reviewed-by: Dev Jain <dev.jain@arm.com>
diff mbox series

Patch

diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index b4df5bc5b1b8..66906c45c7f6 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -952,7 +952,6 @@  static void unmap_hotplug_p4d_range(pgd_t *pgdp, unsigned long addr,
 		if (p4d_none(p4d))
 			continue;
 
-		WARN_ON(!p4d_present(p4d));
 		unmap_hotplug_pud_range(p4dp, addr, next, free_mapped, altmap);
 	} while (addr = next, addr < end);
 }
@@ -978,7 +977,6 @@  static void unmap_hotplug_range(unsigned long addr, unsigned long end,
 		if (pgd_none(pgd))
 			continue;
 
-		WARN_ON(!pgd_present(pgd));
 		unmap_hotplug_p4d_range(pgdp, addr, next, free_mapped, altmap);
 	} while (addr = next, addr < end);
 }
@@ -1114,7 +1112,6 @@  static void free_empty_p4d_table(pgd_t *pgdp, unsigned long addr,
 		if (p4d_none(p4d))
 			continue;
 
-		WARN_ON(!p4d_present(p4d));
 		free_empty_pud_table(p4dp, addr, next, floor, ceiling);
 	} while (addr = next, addr < end);
 
@@ -1153,7 +1150,6 @@  static void free_empty_tables(unsigned long addr, unsigned long end,
 		if (pgd_none(pgd))
 			continue;
 
-		WARN_ON(!pgd_present(pgd));
 		free_empty_p4d_table(pgdp, addr, next, floor, ceiling);
 	} while (addr = next, addr < end);
 }