Index | Thread | Search

From:
Martin Pieuchot <mpi@grenadille.net>
Subject:
Re: fail earlier in pgo_get
To:
Mark Kettenis <mark.kettenis@xs4all.nl>
Cc:
tech@openbsd.org
Date:
Sun, 9 Nov 2025 10:05:23 +0000

Download raw body.

Thread
On 08/11/25(Sat) 22:46, Mark Kettenis wrote:
> > Date: Sat, 8 Nov 2025 17:23:34 +0000
> > From: Martin Pieuchot <mpi@grenadille.net>
> > 
> > On 27/10/25(Mon) 10:34, Martin Pieuchot wrote:
> > > Stop iterating as soon as a page is missing or busy when all pages are
> > > asked by the caller.
> > > 
> > > Note that currently pgo_get() is not called with PGO_ALLPAGES in the
> > > kernel.
> 
> That isn't true; see uvm_obj_wire().

Thanks!

> This change would be fine for that case though and could indeed speed
> things up a bit.

Indeed.

> > > This is a requirement for upcoming changes.
> 
> Can you elaborate on that?  Do those upcoming changes add additional
> pgo_get() calls?

Exactly.

New version with the braces below, ok?

Index: uvm/uvm_aobj.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_aobj.c,v
diff -u -p -r1.116 uvm_aobj.c
--- uvm/uvm_aobj.c	10 Mar 2025 14:13:58 -0000	1.116
+++ uvm/uvm_aobj.c	9 Nov 2025 10:02:43 -0000
@@ -1024,10 +1024,14 @@ uao_get(struct uvm_object *uobj, voff_t 
 			 * to be useful must get a non-busy page
 			 */
 			if (ptmp == NULL || (ptmp->pg_flags & PG_BUSY) != 0) {
-				if (lcv == centeridx ||
-				    (flags & PGO_ALLPAGES) != 0)
+				if (lcv == centeridx) {
 					/* need to do a wait or I/O! */
 					done = FALSE;
+				}
+				if ((flags & PGO_ALLPAGES) != 0) {
+					done = FALSE;
+					break;
+				}
 				continue;
 			}
 
Index: uvm/uvm_vnode.c
===================================================================
RCS file: /cvs/src/sys/uvm/uvm_vnode.c,v
diff -u -p -r1.143 uvm_vnode.c
--- uvm/uvm_vnode.c	8 Nov 2025 17:23:22 -0000	1.143
+++ uvm/uvm_vnode.c	9 Nov 2025 10:02:02 -0000
@@ -990,10 +990,14 @@ uvn_get(struct uvm_object *uobj, voff_t 
 			 * to be useful must get a non-busy page
 			 */
 			if (ptmp == NULL || (ptmp->pg_flags & PG_BUSY) != 0) {
-				if (lcv == centeridx ||
-				    (flags & PGO_ALLPAGES) != 0)
+				if (lcv == centeridx) {
 					/* need to do a wait or I/O! */
 					done = FALSE;
+				}
+				if ((flags & PGO_ALLPAGES) != 0) {
+					done = FALSE;
+					break;
+				}
 				continue;
 			}