From: Mark Kettenis Subject: Re: fail earlier in pgo_get To: Martin Pieuchot Cc: tech@openbsd.org Date: Sat, 08 Nov 2025 22:46:47 +0100 > Date: Sat, 8 Nov 2025 17:23:34 +0000 > From: Martin Pieuchot > > 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(). This change would be fine for that case though and could indeed speed things up a bit. > > This is a requirement for upcoming changes. Can you elaborate on that? Do those upcoming changes add additional pgo_get() calls? > > > > ok? > > Anyone? > > > 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 27 Oct 2025 09:31:40 -0000 > > @@ -1024,10 +1024,13 @@ 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; I think adding a set of curly braces here would make sense. > > + 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.142 uvm_vnode.c > > --- uvm/uvm_vnode.c 29 Sep 2025 09:55:01 -0000 1.142 > > +++ uvm/uvm_vnode.c 27 Oct 2025 09:32:09 -0000 > > @@ -977,10 +990,13 @@ 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; Same here. > > + if ((flags & PGO_ALLPAGES) != 0) { > > + done = FALSE; > > + break; > > + } > > continue; > > } > > > > > > > > >