Index | Thread | Search

From:
Martin Pieuchot <mpi@grenadille.net>
Subject:
Use uvm_pagewait()
To:
tech@openbsd.org
Cc:
tb@openbsd.org
Date:
Mon, 2 Dec 2024 13:33:55 +0100

Download raw body.

Thread
  • Martin Pieuchot:

    Use uvm_pagewait()

Use uvm_pagewait() instead of re-rolling it.  This helps grepping for
places that set the PG_WANTED flag.

ok?

Index: uvm/uvm_fault.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_fault.c,v
diff -u -p -r1.148 uvm_fault.c
--- uvm/uvm_fault.c	29 Nov 2024 06:44:57 -0000	1.148
+++ uvm/uvm_fault.c	2 Dec 2024 12:14:54 -0000
@@ -316,7 +316,6 @@ uvmfault_anonget(struct uvm_faultinfo *u
 			 */
 			if ((pg->pg_flags & (PG_BUSY|PG_RELEASED)) == 0)
 				return 0;
-			atomic_setbits_int(&pg->pg_flags, PG_WANTED);
 			counters_inc(uvmexp_counters, flt_pgwait);
 
 			/*
@@ -326,13 +325,12 @@ uvmfault_anonget(struct uvm_faultinfo *u
 			if (pg->uobject) {
 				/* Owner of page is UVM object. */
 				uvmfault_unlockall(ufi, amap, NULL);
-				rwsleep_nsec(pg, pg->uobject->vmobjlock,
-				    PVM | PNORELOCK, "anonget1", INFSLP);
+				uvm_pagewait(pg, pg->uobject->vmobjlock,
+				    "anonget1");
 			} else {
 				/* Owner of page is anon. */
 				uvmfault_unlockall(ufi, NULL, NULL);
-				rwsleep_nsec(pg, anon->an_lock, PVM | PNORELOCK,
-				    "anonget2", INFSLP);
+				uvm_pagewait(pg, anon->an_lock, "anonget2");
 			}
 		} else {
 			/*