From: Theo Buehler Subject: Re: Deactivating pages & PROT_NONE To: tech@openbsd.org Date: Tue, 24 Dec 2024 11:20:06 +0100 On Tue, Dec 24, 2024 at 10:51:19AM +0100, Martin Pieuchot wrote: > When the kernel decides to move a page to the inactive list, with > uvm_pagedeactivate(), it also remove its pmap references to ensure > the next access will generate a fault. > > Diff below moves the pmap_page_protect(9) call inside uvm_pagedeactivate(). > > This is a baby step towards reducing the contention on the `pageqlock'. > > I'm aware that many more improvements are possible. I'm trying to move > very slowly to not introduce too many changes in behavior and expose > existing bugs. That's why I'm keeping the existing behavior of always > calling pmap_page_protect(9) inside uvm_pagedeactivate(). Makes sense > Note that currently, one call to uvm_pagedeactivate() is not coupled with > a pmap_page_protect(), the diff below fixes that/makes it coherent. Looks correct. ok tb You could remove the braces in uvm_fault.c and uvm_vnode.c as style(9) incoherently requires and makes optional at the same time.