Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm vm_page: Now that listq is gone, give the pagedaemon...



details:   https://anonhg.NetBSD.org/src/rev/1af8d756d405
branches:  trunk
changeset: 1005958:1af8d756d405
user:      ad <ad%NetBSD.org@localhost>
date:      Fri Dec 27 13:13:17 2019 +0000

description:
vm_page: Now that listq is gone, give the pagedaemon its own private
TAILQ_ENTRY, so that update of page replacement state can be made
asynchronous/lazy.  No functional change.

diffstat:

 sys/uvm/uvm_page.h              |   5 +++--
 sys/uvm/uvm_pdpolicy_clock.c    |  18 +++++++++---------
 sys/uvm/uvm_pdpolicy_clockpro.c |  22 +++++++++++-----------
 3 files changed, 23 insertions(+), 22 deletions(-)

diffs (201 lines):

diff -r 6611707aee0e -r 1af8d756d405 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h        Fri Dec 27 12:53:40 2019 +0000
+++ b/sys/uvm/uvm_page.h        Fri Dec 27 13:13:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_page.h,v 1.89 2019/12/27 12:51:57 ad Exp $ */
+/*     $NetBSD: uvm_page.h,v 1.90 2019/12/27 13:13:17 ad Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -150,12 +150,13 @@
                                                 * or uvm_pglistalloc output */
                LIST_ENTRY(vm_page) list;       /* f: global free page queue */
        } pageq;
+       TAILQ_ENTRY(vm_page)    pdqueue;        /* p: pagedaemon queue */
        struct vm_anon          *uanon;         /* o,i: anon */
        struct uvm_object       *uobject;       /* o,i: object */
        voff_t                  offset;         /* o: offset into object */
        uint16_t                flags;          /* o: object flags */
        uint16_t                spare;          /*  : spare for now */
-       uint32_t                pqflags;        /* p: pdpolicy queue flags */
+       uint32_t                pqflags;        /* p: pagedaemon flags */
        uint32_t                loan_count;     /* o,i: num. active loans */
        uint32_t                wire_count;     /* o,i: wired down map refs */
        paddr_t                 phys_addr;      /* o: physical address of pg */
diff -r 6611707aee0e -r 1af8d756d405 sys/uvm/uvm_pdpolicy_clock.c
--- a/sys/uvm/uvm_pdpolicy_clock.c      Fri Dec 27 12:53:40 2019 +0000
+++ b/sys/uvm/uvm_pdpolicy_clock.c      Fri Dec 27 13:13:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdpolicy_clock.c,v 1.22 2019/12/23 19:29:03 ad Exp $       */
+/*     $NetBSD: uvm_pdpolicy_clock.c,v 1.23 2019/12/27 13:13:17 ad Exp $       */
 /*     NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $     */
 
 /*
@@ -69,7 +69,7 @@
 #else /* defined(PDSIM) */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.22 2019/12/23 19:29:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.23 2019/12/27 13:13:17 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -207,7 +207,7 @@
                if (pg == NULL) {
                        break;
                }
-               ss->ss_nextpg = TAILQ_NEXT(pg, pageq.queue);
+               ss->ss_nextpg = TAILQ_NEXT(pg, pdqueue);
                uvmexp.pdscans++;
 
                /*
@@ -313,7 +313,7 @@
        for (p = TAILQ_FIRST(&pdpol_state.s_activeq);
             p != NULL && (inactive_shortage > 0 || swap_shortage > 0);
             p = nextpg) {
-               nextpg = TAILQ_NEXT(p, pageq.queue);
+               nextpg = TAILQ_NEXT(p, pdqueue);
 
                /*
                 * if there's a shortage of swap slots, try to free it.
@@ -371,7 +371,7 @@
        KASSERT(uvm_page_locked_p(pg));
 
        if (pg->pqflags & PQ_ACTIVE) {
-               TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pageq.queue);
+               TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pdqueue);
                pg->pqflags &= ~(PQ_ACTIVE | PQ_TIME);
                KASSERT(pdpol_state.s_active > 0);
                pdpol_state.s_active--;
@@ -379,7 +379,7 @@
        if ((pg->pqflags & PQ_INACTIVE) == 0) {
                KASSERT(pg->wire_count == 0);
                pmap_clear_reference(pg);
-               TAILQ_INSERT_TAIL(&pdpol_state.s_inactiveq, pg, pageq.queue);
+               TAILQ_INSERT_TAIL(&pdpol_state.s_inactiveq, pg, pdqueue);
                pg->pqflags |= PQ_INACTIVE;
                pdpol_state.s_inactive++;
        }
@@ -400,7 +400,7 @@
 {
 
        uvmpdpol_pagedequeue_locked(pg);
-       TAILQ_INSERT_TAIL(&pdpol_state.s_activeq, pg, pageq.queue);
+       TAILQ_INSERT_TAIL(&pdpol_state.s_activeq, pg, pdqueue);
        pg->pqflags = PQ_ACTIVE | (hardclock_ticks & PQ_TIME);
        pdpol_state.s_active++;
 }
@@ -424,12 +424,12 @@
 {
 
        if (pg->pqflags & PQ_ACTIVE) {
-               TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pageq.queue);
+               TAILQ_REMOVE(&pdpol_state.s_activeq, pg, pdqueue);
                pg->pqflags &= ~(PQ_ACTIVE | PQ_TIME);
                KASSERT(pdpol_state.s_active > 0);
                pdpol_state.s_active--;
        } else if (pg->pqflags & PQ_INACTIVE) {
-               TAILQ_REMOVE(&pdpol_state.s_inactiveq, pg, pageq.queue);
+               TAILQ_REMOVE(&pdpol_state.s_inactiveq, pg, pdqueue);
                pg->pqflags &= ~PQ_INACTIVE;
                KASSERT(pdpol_state.s_inactive > 0);
                pdpol_state.s_inactive--;
diff -r 6611707aee0e -r 1af8d756d405 sys/uvm/uvm_pdpolicy_clockpro.c
--- a/sys/uvm/uvm_pdpolicy_clockpro.c   Fri Dec 27 12:53:40 2019 +0000
+++ b/sys/uvm/uvm_pdpolicy_clockpro.c   Fri Dec 27 13:13:17 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uvm_pdpolicy_clockpro.c,v 1.18 2019/12/13 20:10:22 ad Exp $    */
+/*     $NetBSD: uvm_pdpolicy_clockpro.c,v 1.19 2019/12/27 13:13:17 ad Exp $    */
 
 /*-
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -43,7 +43,7 @@
 #else /* defined(PDSIM) */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.18 2019/12/13 20:10:22 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clockpro.c,v 1.19 2019/12/27 13:13:17 ad Exp $");
 
 #include "opt_ddb.h"
 
@@ -234,7 +234,7 @@
 pageq_insert_tail(pageq_t *q, struct vm_page *pg)
 {
 
-       TAILQ_INSERT_TAIL(&q->q_q, pg, pageq.queue);
+       TAILQ_INSERT_TAIL(&q->q_q, pg, pdqueue);
        q->q_len++;
 }
 
@@ -243,7 +243,7 @@
 pageq_insert_head(pageq_t *q, struct vm_page *pg)
 {
 
-       TAILQ_INSERT_HEAD(&q->q_q, pg, pageq.queue);
+       TAILQ_INSERT_HEAD(&q->q_q, pg, pdqueue);
        q->q_len++;
 }
 #endif
@@ -256,7 +256,7 @@
        KASSERT(clockpro_queue(&clockpro, clockpro_getq(pg)) == q);
 #endif
        KASSERT(q->q_len > 0);
-       TAILQ_REMOVE(&q->q_q, pg, pageq.queue);
+       TAILQ_REMOVE(&q->q_q, pg, pdqueue);
        q->q_len--;
 }
 
@@ -1308,7 +1308,7 @@
 
        KASSERT(mutex_owned(&clockpro.lock));
 
-       TAILQ_FOREACH_REVERSE(pg, &q->q_q, pglist, pageq.queue) {
+       TAILQ_FOREACH_REVERSE(pg, &q->q_q, pglist, pdqueue) {
                if (*todo <= 0) {
                        break;
                }
@@ -1439,7 +1439,7 @@
            (name), nhot, ncold, ntest, nspeculative, ninitialref, nref)
 
        INITCOUNT();
-       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_NEWQ)->q_q, pageq.queue) {
+       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_NEWQ)->q_q, pdqueue) {
                if (clockpro_getq(pg) != CLOCKPRO_NEWQ) {
                        printf("newq corrupt %p\n", pg);
                }
@@ -1449,7 +1449,7 @@
        PRINTCOUNT("newq");
 
        INITCOUNT();
-       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_COLDQ)->q_q, pageq.queue) {
+       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_COLDQ)->q_q, pdqueue) {
                if (clockpro_getq(pg) != CLOCKPRO_COLDQ) {
                        printf("coldq corrupt %p\n", pg);
                }
@@ -1459,7 +1459,7 @@
        PRINTCOUNT("coldq");
 
        INITCOUNT();
-       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_HOTQ)->q_q, pageq.queue) {
+       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_HOTQ)->q_q, pdqueue) {
                if (clockpro_getq(pg) != CLOCKPRO_HOTQ) {
                        printf("hotq corrupt %p\n", pg);
                }
@@ -1474,7 +1474,7 @@
        PRINTCOUNT("hotq");
 
        INITCOUNT();
-       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_LISTQ)->q_q, pageq.queue) {
+       TAILQ_FOREACH(pg, &clockpro_queue(s, CLOCKPRO_LISTQ)->q_q, pdqueue) {
 #if !defined(LISTQ)
                printf("listq %p\n", pg);
 #endif /* !defined(LISTQ) */
@@ -1504,7 +1504,7 @@
        pageq_t *q = clockpro_queue(s, qidx);
        struct vm_page *pg;
 
-       TAILQ_FOREACH(pg, &q->q_q, pageq.queue) {
+       TAILQ_FOREACH(pg, &q->q_q, pdqueue) {
                DPRINTF(" %" PRIu64 "%s%s%s%s%s%s",
                    pg->offset >> PAGE_SHIFT,
                    (pg->pqflags & PQ_HOT) ? "H" : "",



Home | Main Index | Thread Index | Old Index