Merge swap-backed and object-backed inactive page lists.
authormpi <mpi@openbsd.org>
Wed, 4 May 2022 14:58:26 +0000 (14:58 +0000)
committermpi <mpi@openbsd.org>
Wed, 4 May 2022 14:58:26 +0000 (14:58 +0000)
ok millert@, kettenis@

sys/uvm/uvm.h
sys/uvm/uvm_map.c
sys/uvm/uvm_page.c
sys/uvm/uvm_pdaemon.c

index 40c38ab..04c5aef 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm.h,v 1.68 2020/11/24 13:49:09 mpi Exp $    */
+/*     $OpenBSD: uvm.h,v 1.69 2022/05/04 14:58:26 mpi Exp $    */
 /*     $NetBSD: uvm.h,v 1.24 2000/11/27 08:40:02 chs Exp $     */
 
 /*
@@ -53,8 +53,7 @@ struct uvm {
 
        /* vm_page queues */
        struct pglist page_active;      /* [Q] allocated pages, in use */
-       struct pglist page_inactive_swp;/* [Q] pages inactive (reclaim/free) */
-       struct pglist page_inactive_obj;/* [Q] pages inactive (reclaim/free) */
+       struct pglist page_inactive;    /* [Q] pages inactive (reclaim/free) */
        /* Lock order: pageqlock, then fpageqlock. */
        struct mutex pageqlock;         /* [] lock for active/inactive page q */
        struct mutex fpageqlock;        /* [] lock for free page q  + pdaemon */
index 1375230..77c2727 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_map.c,v 1.290 2022/03/12 08:11:07 mpi Exp $       */
+/*     $OpenBSD: uvm_map.c,v 1.291 2022/05/04 14:58:26 mpi Exp $       */
 /*     $NetBSD: uvm_map.c,v 1.86 2000/11/27 08:40:03 chs Exp $ */
 
 /*
@@ -3281,8 +3281,7 @@ uvm_page_printit(struct vm_page *pg, boolean_t full,
                        (*pr)("  >>> page not found in uvm_pmemrange <<<\n");
                pgl = NULL;
        } else if (pg->pg_flags & PQ_INACTIVE) {
-               pgl = (pg->pg_flags & PQ_SWAPBACKED) ?
-                   &uvm.page_inactive_swp : &uvm.page_inactive_obj;
+               pgl = &uvm.page_inactive;
        } else if (pg->pg_flags & PQ_ACTIVE) {
                pgl = &uvm.page_active;
        } else {
index 7716597..03e1299 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_page.c,v 1.164 2022/04/28 09:59:28 mpi Exp $      */
+/*     $OpenBSD: uvm_page.c,v 1.165 2022/05/04 14:58:26 mpi Exp $      */
 /*     $NetBSD: uvm_page.c,v 1.44 2000/11/27 08:40:04 chs Exp $        */
 
 /*
@@ -185,8 +185,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr_t *kvm_endp)
         */
 
        TAILQ_INIT(&uvm.page_active);
-       TAILQ_INIT(&uvm.page_inactive_swp);
-       TAILQ_INIT(&uvm.page_inactive_obj);
+       TAILQ_INIT(&uvm.page_inactive);
        mtx_init(&uvm.pageqlock, IPL_VM);
        mtx_init(&uvm.fpageqlock, IPL_VM);
        uvm_pmr_init();
@@ -994,10 +993,7 @@ uvm_pageclean(struct vm_page *pg)
                uvmexp.active--;
        }
        if (pg->pg_flags & PQ_INACTIVE) {
-               if (pg->pg_flags & PQ_SWAPBACKED)
-                       TAILQ_REMOVE(&uvm.page_inactive_swp, pg, pageq);
-               else
-                       TAILQ_REMOVE(&uvm.page_inactive_obj, pg, pageq);
+               TAILQ_REMOVE(&uvm.page_inactive, pg, pageq);
                flags_to_clear |= PQ_INACTIVE;
                uvmexp.inactive--;
        }
@@ -1253,10 +1249,7 @@ uvm_pagewire(struct vm_page *pg)
                        uvmexp.active--;
                }
                if (pg->pg_flags & PQ_INACTIVE) {
-                       if (pg->pg_flags & PQ_SWAPBACKED)
-                               TAILQ_REMOVE(&uvm.page_inactive_swp, pg, pageq);
-                       else
-                               TAILQ_REMOVE(&uvm.page_inactive_obj, pg, pageq);
+                       TAILQ_REMOVE(&uvm.page_inactive, pg, pageq);
                        atomic_clearbits_int(&pg->pg_flags, PQ_INACTIVE);
                        uvmexp.inactive--;
                }
@@ -1304,10 +1297,7 @@ uvm_pagedeactivate(struct vm_page *pg)
        }
        if ((pg->pg_flags & PQ_INACTIVE) == 0) {
                KASSERT(pg->wire_count == 0);
-               if (pg->pg_flags & PQ_SWAPBACKED)
-                       TAILQ_INSERT_TAIL(&uvm.page_inactive_swp, pg, pageq);
-               else
-                       TAILQ_INSERT_TAIL(&uvm.page_inactive_obj, pg, pageq);
+               TAILQ_INSERT_TAIL(&uvm.page_inactive, pg, pageq);
                atomic_setbits_int(&pg->pg_flags, PQ_INACTIVE);
                uvmexp.inactive++;
                pmap_clear_reference(pg);
@@ -1335,10 +1325,7 @@ uvm_pageactivate(struct vm_page *pg)
        MUTEX_ASSERT_LOCKED(&uvm.pageqlock);
 
        if (pg->pg_flags & PQ_INACTIVE) {
-               if (pg->pg_flags & PQ_SWAPBACKED)
-                       TAILQ_REMOVE(&uvm.page_inactive_swp, pg, pageq);
-               else
-                       TAILQ_REMOVE(&uvm.page_inactive_obj, pg, pageq);
+               TAILQ_REMOVE(&uvm.page_inactive, pg, pageq);
                atomic_clearbits_int(&pg->pg_flags, PQ_INACTIVE);
                uvmexp.inactive--;
        }
index e7eebee..f2ab570 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_pdaemon.c,v 1.97 2022/04/30 17:58:43 mpi Exp $    */
+/*     $OpenBSD: uvm_pdaemon.c,v 1.98 2022/05/04 14:58:26 mpi Exp $    */
 /*     $NetBSD: uvm_pdaemon.c,v 1.23 2000/08/20 10:24:14 bjh21 Exp $   */
 
 /*
@@ -395,13 +395,6 @@ uvmpd_scan_inactive(struct pglist *pglst)
        vaddr_t start;
        int dirtyreacts;
 
-       /*
-        * note: we currently keep swap-backed pages on a separate inactive
-        * list from object-backed pages.   however, merging the two lists
-        * back together again hasn't been ruled out.   thus, we keep our
-        * swap cluster in "swpps" rather than in pps (allows us to mix
-        * clustering types in the event of a mixed inactive queue).
-        */
        /*
         * swslot is non-zero if we are building a swap cluster.  we want
         * to stay in the loop while we have a page to scan or we have
@@ -881,7 +874,6 @@ uvmpd_scan(void)
        struct uvm_object *uobj;
        struct vm_anon *anon;
        struct rwlock *slock;
-       boolean_t got_it;
 
        MUTEX_ASSERT_LOCKED(&uvm.pageqlock);
 
@@ -917,14 +909,8 @@ uvmpd_scan(void)
         * alternate starting queue between swap and object based on the
         * low bit of uvmexp.pdrevs (which we bump by one each call).
         */
-       got_it = FALSE;
-       pages_freed = uvmexp.pdfreed;   /* XXX - int */
-       if ((uvmexp.pdrevs & 1) != 0 && uvmexp.nswapdev != 0)
-               got_it = uvmpd_scan_inactive(&uvm.page_inactive_swp);
-       if (!got_it)
-               got_it = uvmpd_scan_inactive(&uvm.page_inactive_obj);
-       if (!got_it && (uvmexp.pdrevs & 1) == 0 && uvmexp.nswapdev != 0)
-               (void) uvmpd_scan_inactive(&uvm.page_inactive_swp);
+       pages_freed = uvmexp.pdfreed;
+       (void) uvmpd_scan_inactive(&uvm.page_inactive);
        pages_freed = uvmexp.pdfreed - pages_freed;
 
        /*
@@ -1069,8 +1055,7 @@ uvmpd_drop(struct pglist *pglst)
 void
 uvmpd_hibernate(void)
 {
-       uvmpd_drop(&uvm.page_inactive_swp);
-       uvmpd_drop(&uvm.page_inactive_obj);
+       uvmpd_drop(&uvm.page_inactive);
        uvmpd_drop(&uvm.page_active);
 }