CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/01/04 14:00:18
Modified files:
sys/uvm : uvm_pdaemon.c
Log message:
Revert the change made in rev 1.126 of uvm_pdaemon.c
While the commit message was
"Do not try to release memory if all we need is balancing the page lists."
This is not what this actually did. It also removed the minumum amount of
pages that the page daemon would attempt to free, and most importantly,
it would make the page daemon potentially go back to sleep when woken
wihtout waking the sleepers that went to sleep waiting for it to free
memory and wake them up.
Since *someone* probably went to sleep when waking the page daemon, and
today we have no idea if that sleeper's request could have been satisfied
by the page daemon's free page reserve (as we have no idea how fragmented
the free pages are, or where they are in memory) this is currently dangerous.
While the "hack" of freeing up 16 pages every time it is woken is indeed
a hack, it does mean that something that is failing to allocate will force
the page daemon to attempt to free up *some* memory every time, so it can
proceed, and, it is guaranteed to be woken up once that has been attempted
to attempt to progress. With this change the wakeup is not guaranteed
and at least a bunch of our page daemon problems appear to be related
to missing wakeups.
Maybe someday the page daemon could have all the information to know
that all outstanding memory requests can be satisfied by the pages it
currently has freed, but that is certainly not the case now, so I
think we need to be very carefule to ensure we attempt to make some
forward progress and wake the sleepers to see if their needs are met.
This may not be the only one, but I'm starting from this point.
Tested with torture swap on my machines in single and mp kernels
and doesn't seem to make things worse.
ok deraadt@