So it seems that hardware reference and change bit updates are busted
on POWER9 CPUs.  Or at least they don't work the way I'm reading the
specs.  So I've changed the pmap for OpenBSD/powerpc64 to emulate them
instead.

While implementing this code I wondered how this is supposed to work
for pages that are faulted in speculatively by uvm_fault().  Strict
emulation of the reference bit would force me to not emter the PTEs
for these mappings and wait until I get another page fault for the
page itself.  That seems to defeat the purpose of speculatively
faulting them in.

It occurred to me that it isn't crucial that the reference bit is 100%
correct.  It is merely used as an optimization to keep the pagedaemon
throwing out pages that have been recently used.  So what I did is
mark the pages that have been speculatively faulted in as referenced.
When the pagedaemon comes by it will first clear the reference bit.
It will only move these pages to the inactive list the 2nd time
around.  If we are really low on physical memory this will probably
slow things down a bit.  But if there is plenty of memory available,
this will potentially prevent many page faults.

So is this a reasonable thing to do?

Reply via email to