Download raw body.
Honor WAITOK flag
uvm_pagermapin() is called with the WAITOK flag during page faults in
uvn_io(). There, it is expected to block if necessary and return a
valid kva.
bluhm@ reported in august a bug where this didn't happen:
https://marc.info/?l=openbsd-bugs&m=175648751931652&w=2
Diff below fixes the issue by waking the pdaemon and sleeping for memory
if pmap_enter(9) fails.
Note that the pdaemon doesn't pass the WAITOK flag when it calls this
function.
ok?
Index: uvm/uvm_pager.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_pager.c,v
diff -u -p -r1.94 uvm_pager.c
--- uvm/uvm_pager.c 10 Mar 2025 14:13:58 -0000 1.94
+++ uvm/uvm_pager.c 6 Oct 2025 08:13:07 -0000
@@ -263,13 +263,16 @@ uvm_pagermapin(struct vm_page **pps, int
pp = *pps++;
KASSERT(pp);
KASSERT(pp->pg_flags & PG_BUSY);
- /* Allow pmap_enter to fail. */
- if (pmap_enter(pmap_kernel(), cva, VM_PAGE_TO_PHYS(pp),
+ while (pmap_enter(pmap_kernel(), cva, VM_PAGE_TO_PHYS(pp),
prot, PMAP_WIRED | PMAP_CANFAIL | prot) != 0) {
- pmap_remove(pmap_kernel(), kva, cva);
- pmap_update(pmap_kernel());
- uvm_pseg_release(kva);
- return 0;
+ if (flags & UVMPAGER_MAPIN_WAITOK)
+ uvm_wait("pgrmapin");
+ else {
+ pmap_remove(pmap_kernel(), kva, cva);
+ pmap_update(pmap_kernel());
+ uvm_pseg_release(kva);
+ return 0;
+ }
}
}
pmap_update(pmap_kernel());
Honor WAITOK flag