The branch main has been updated by bnovkov:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=200de4dc0716ae2cc2b0995ccb6eee555d14c751

commit 200de4dc0716ae2cc2b0995ccb6eee555d14c751
Author:     Bojan Novković <bnov...@freebsd.org>
AuthorDate: 2024-06-13 16:03:31 +0000
Commit:     Bojan Novković <bnov...@freebsd.org>
CommitDate: 2024-06-16 16:19:26 +0000

    powerpc_mmu_radix: Introduce 'pmap_abort_ptp'
    
    This commit moves code for releasing pagetable page references
    into a separate function. No functional change intended.
    
    Approved by: markj (mentor)
    Differential Revision:  https://reviews.freebsd.org/D45581
---
 sys/powerpc/aim/mmu_radix.c | 34 +++++++++++++++++++++++-----------
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c
index 0a534e3f9d3f..746b1ef49a99 100644
--- a/sys/powerpc/aim/mmu_radix.c
+++ b/sys/powerpc/aim/mmu_radix.c
@@ -3137,6 +3137,28 @@ out:
        return (rv);
 }
 
+/*
+ * Release a page table page reference after a failed attempt to create a
+ * mapping.
+ */
+static void
+pmap_abort_ptp(pmap_t pmap, vm_offset_t va, vm_page_t pdpg)
+{
+       struct spglist free;
+
+       SLIST_INIT(&free);
+       if (pmap_unwire_ptp(pmap, va, pdpg, &free)) {
+               /*
+                * Although "va" is not mapped, paging-
+                * structure caches could nonetheless have
+                * entries that refer to the freed page table
+                * pages.  Invalidate those entries.
+                */
+               pmap_invalidate_page(pmap, va);
+               vm_page_free_pages_toq(&free, true);
+       }
+}
+
 /*
  * Tries to create a read- and/or execute-only 2MB page mapping.  Returns true
  * if successful.  Returns false if (1) a page table page cannot be allocated
@@ -3264,17 +3286,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t 
newpde, u_int flags,
                 * Abort this mapping if its PV entry could not be created.
                 */
                if (!pmap_pv_insert_l3e(pmap, va, newpde, flags, lockp)) {
-                       SLIST_INIT(&free);
-                       if (pmap_unwire_ptp(pmap, va, pdpg, &free)) {
-                               /*
-                                * Although "va" is not mapped, paging-
-                                * structure caches could nonetheless have
-                                * entries that refer to the freed page table
-                                * pages.  Invalidate those entries.
-                                */
-                               pmap_invalidate_page(pmap, va);
-                               vm_page_free_pages_toq(&free, true);
-                       }
+                       pmap_abort_ptp(pmap, va, pdpg);
                        if (uwptpg != NULL) {
                                mt = pmap_remove_pt_page(pmap, va);
                                KASSERT(mt == uwptpg,

Reply via email to