Page MenuHomeFreeBSD

D36563.1784978767.diff
No OneTemporary

Size
999 B
Referenced Files
None
Subscribers
None

D36563.1784978767.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
@@ -3184,6 +3184,15 @@
if ((oldl2 = pmap_load(l2)) != 0) {
KASSERT(l2pg->ref_count > 1,
("pmap_enter_l2: l2pg's ref count is too low"));
+ if ((oldl2 & ~(PTE_D | PTE_A)) == new_l2) {
+ /* Mapping exists; it doesn't need a new reference. */
+ l2pg->ref_count--;
+ CTR2(KTR_PMAP,
+ "pmap_enter_l2: success for va %#lx in pmap %p; "
+ "pre-existing mapping\n",
+ va, pmap);
+ return (KERN_SUCCESS);
+ }
if ((flags & PMAP_ENTER_NOREPLACE) != 0) {
l2pg->ref_count--;
CTR2(KTR_PMAP,
@@ -3374,6 +3383,9 @@
* attempt fails, we don't retry. Instead, we give up.
*/
if (l2 != NULL && pmap_load(l2) != 0) {
+ KASSERT((pmap_load(l2) & PTE_RWX) == 0,
+ ("%s: unexpected L2 leaf for va %#lx",
+ __func__, va));
phys = PTE_TO_PHYS(pmap_load(l2));
mpte = PHYS_TO_VM_PAGE(phys);
mpte->ref_count++;

File Metadata

Mime Type
text/plain
Expires
Sat, Jul 25, 11:26 AM (6 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29255158
Default Alt Text
D36563.1784978767.diff (999 B)

Event Timeline