Index | Thread | Search

From:
Theo Buehler <tb@theobuehler.org>
Subject:
Re: fault ahead & page wiring
To:
tech@openbsd.org
Date:
Wed, 27 Nov 2024 11:42:31 +0100

Download raw body.

Thread
On Wed, Nov 27, 2024 at 11:04:26AM +0100, Martin Pieuchot wrote:
> On 25/11/24(Mon) 15:15, Martin Pieuchot wrote:
> > When a wired fault occurs, uvm_fault_check() disables looking & faulting
> > neighbor pages.  This is done line 702 by setting `narrow' to TRUE.
> > 
> > When a fault is "narrow" the kernel only looks at a single page and there
> > is no "fault-ahead".
> > 
> > So instead of syncing with NetBSD and using `flt->wired' coherently for
> > the pmap_enter(9) below, assert that such condition is impossible.
> 
> I have been asked off-list why this KASSERT() couldn't be reached.  This
> is because when the fault is "narrow", which is always the case for wired
> faults, only a single page is mapped in the memory space.  Line 775 we
> see:
> 
> 	f (flt->narrow == FALSE) {
> 		[...]
>         } else {
>                 /* narrow fault! */
>                 nback = nforw = 0;
>                 flt->startva = ufi->orig_rvaddr;
>                 flt->npages = 1;
>                 flt->centeridx = 0;
>         }
> 
> `npages' being 1 and `centeridx' being 0 ensure that the first and only page 
> found in the iterations below will be skipped.

Ah. That's what I was missing. Thanks for the explanation.

> d
> While here use FALSE instead of 0 to be consistent with the rest of the
> file.
> 
> ok?

ok tb