Page MenuHomeFreeBSD

D42289.diff
No OneTemporary

D42289.diff

diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -256,7 +256,7 @@
static struct rwlock_padalign pvh_global_lock;
static struct mtx_padalign allpmaps_lock;
-static int superpages_enabled = 1;
+static int __read_frequently superpages_enabled = 1;
SYSCTL_INT(_vm_pmap, OID_AUTO, superpages_enabled,
CTLFLAG_RDTUN, &superpages_enabled, 0,
"Enable support for transparent superpages");
@@ -2759,7 +2759,7 @@
}
#if VM_NRESERVLEVEL > 0
-static void
+static bool
pmap_promote_l2(pmap_t pmap, pd_entry_t *l2, vm_offset_t va, vm_page_t ml3,
struct rwlock **lockp)
{
@@ -2767,6 +2767,8 @@
vm_paddr_t pa;
PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+ if (!pmap_ps_enabled(pmap))
+ return (false);
KASSERT((pmap_load(l2) & PTE_RWX) == 0,
("pmap_promote_l2: invalid l2 entry %p", l2));
@@ -2783,7 +2785,7 @@
CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p",
va, pmap);
atomic_add_long(&pmap_l2_p_failures, 1);
- return;
+ return (false);
}
/*
@@ -2817,7 +2819,7 @@
"pmap_promote_l2: failure for va %#lx pmap %p",
va, pmap);
atomic_add_long(&pmap_l2_p_failures, 1);
- return;
+ return (false);
}
while ((l3e & (PTE_W | PTE_D)) == PTE_W) {
if (atomic_fcmpset_64(l3, &l3e, l3e & ~PTE_W)) {
@@ -2830,7 +2832,7 @@
"pmap_promote_l2: failure for va %#lx pmap %p",
va, pmap);
atomic_add_long(&pmap_l2_p_failures, 1);
- return;
+ return (false);
}
all_l3e_PTE_A &= l3e;
pa -= PAGE_SIZE;
@@ -2857,7 +2859,7 @@
CTR2(KTR_PMAP, "pmap_promote_l2: failure for va %#lx pmap %p",
va, pmap);
atomic_add_long(&pmap_l2_p_failures, 1);
- return;
+ return (false);
}
if ((firstl3e & PTE_SW_MANAGED) != 0)
@@ -2868,6 +2870,7 @@
atomic_add_long(&pmap_l2_promotions, 1);
CTR2(KTR_PMAP, "pmap_promote_l2: success for va %#lx in pmap %p", va,
pmap);
+ return (true);
}
#endif
@@ -3133,10 +3136,9 @@
#if VM_NRESERVLEVEL > 0
if (mpte != NULL && mpte->ref_count == Ln_ENTRIES &&
- pmap_ps_enabled(pmap) &&
(m->flags & PG_FICTITIOUS) == 0 &&
vm_reserv_level_iffullpop(m) == 0)
- pmap_promote_l2(pmap, l2, va, mpte, &lock);
+ (void)pmap_promote_l2(pmap, l2, va, mpte, &lock);
#endif
rv = KERN_SUCCESS;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 5:32 PM (20 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14682644
Default Alt Text
D42289.diff (2 KB)

Event Timeline