Improve responsiveness in OOM situations & make free target checks coherent.
authormpi <mpi@openbsd.org>
Wed, 2 Oct 2024 10:24:11 +0000 (10:24 +0000)
committermpi <mpi@openbsd.org>
Wed, 2 Oct 2024 10:24:11 +0000 (10:24 +0000)
Remove a change introduced in NetBSD to pageout 4 times as many pages as
required to meet the low water mark of free pages.   With todays' Gbs of
RAMs, it makes the pagedaemon hog the CPU for too long when the amount of
free pages is close to none.

ok sthen@, kettenis@

sys/uvm/uvm_pdaemon.c

index be32a5a..973b4ac 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_pdaemon.c,v 1.115 2024/09/30 08:09:39 mpi Exp $   */
+/*     $OpenBSD: uvm_pdaemon.c,v 1.116 2024/10/02 10:24:11 mpi Exp $   */
 /*     $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $   */
 
 /*
@@ -468,7 +468,7 @@ uvmpd_scan_inactive(struct uvm_pmalloc *pma,
                         */
                        free = uvmexp.free - BUFPAGES_DEFICIT;
                        if (((pma == NULL || (pma->pm_flags & UVM_PMA_FREED)) &&
-                           (free + uvmexp.paging >= uvmexp.freetarg << 2)) ||
+                           (free + uvmexp.paging >= uvmexp.freetarg)) ||
                            dirtyreacts == UVMPD_NUMDIRTYREACTS) {
                                if (swslot == 0) {
                                        /* exit now if no swap-i/o pending */
@@ -565,7 +565,7 @@ uvmpd_scan_inactive(struct uvm_pmalloc *pma,
                         * free target when all the current pageouts complete.
                         */
                        if ((pma == NULL || (pma->pm_flags & UVM_PMA_FREED)) &&
-                           (free + uvmexp.paging > uvmexp.freetarg << 2)) {
+                           (free + uvmexp.paging > uvmexp.freetarg)) {
                                rw_exit(slock);
                                continue;
                        }