Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm uvmpdpol_pageactive(): the change to not re-activate...
details: https://anonhg.NetBSD.org/src/rev/1e7bdd7d8563
branches: trunk
changeset: 968603:1e7bdd7d8563
user: ad <ad%NetBSD.org@localhost>
date: Tue Jan 21 20:37:06 2020 +0000
description:
uvmpdpol_pageactive(): the change to not re-activate recently activated
pages worked great with uvm_pageqlock, but it doesn't buy anything any more,
because now the busy pages are likely in a per-CPU queue somewhere waiting
to be processed, and changing the intent on those queued pages costs next
to nothing. Remove this and get back all the bits in pg->pqflags.
diffstat:
sys/uvm/uvm_page.c | 20 ++++++++++++--------
sys/uvm/uvm_page.h | 18 ++++++++++--------
sys/uvm/uvm_pdpolicy_clock.c | 21 ++++-----------------
3 files changed, 26 insertions(+), 33 deletions(-)
diffs (153 lines):
diff -r 9767011d9a3d -r 1e7bdd7d8563 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Tue Jan 21 20:31:57 2020 +0000
+++ b/sys/uvm/uvm_page.c Tue Jan 21 20:37:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.224 2020/01/15 17:55:45 ad Exp $ */
+/* $NetBSD: uvm_page.c,v 1.225 2020/01/21 20:37:06 ad Exp $ */
/*-
* Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.224 2020/01/15 17:55:45 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.225 2020/01/21 20:37:06 ad Exp $");
#include "opt_ddb.h"
#include "opt_uvm.h"
@@ -2149,6 +2149,7 @@
*/
static const char page_flagbits[] = UVM_PGFLAGBITS;
+static const char page_pqflagbits[] = UVM_PQFLAGBITS;
void
uvm_page_printit(struct vm_page *pg, bool full,
@@ -2162,12 +2163,15 @@
(*pr)("PAGE %p:\n", pg);
snprintb(pgbuf, sizeof(pgbuf), page_flagbits, pg->flags);
- (*pr)(" flags=%s\n pqflags=%x, wire_count=%d, pa=0x%lx\n",
- pgbuf, pg->pqflags, pg->wire_count, (long)VM_PAGE_TO_PHYS(pg));
- (*pr)(" uobject=%p, uanon=%p, offset=0x%llx loan_count=%d\n",
- pg->uobject, pg->uanon, (long long)pg->offset, pg->loan_count);
- (*pr)(" bucket=%d freelist=%d\n",
- uvm_page_get_bucket(pg), uvm_page_get_freelist(pg));
+ (*pr)(" flags=%s\n", pgbuf);
+ snprintb(pgbuf, sizeof(pgbuf), page_pqflagbits, pg->pqflags);
+ (*pr)(" pqflags=%s\n", pgbuf);
+ (*pr)(" uobject=%p, uanon=%p, offset=0x%llx\n",
+ pg->uobject, pg->uanon, (long long)pg->offset);
+ (*pr)(" loan_count=%d wire_count=%d bucket=%d freelist=%d\n",
+ pg->loan_count, pg->wire_count, uvm_page_get_bucket(pg),
+ uvm_page_get_freelist(pg));
+ (*pr)(" pa=0x%lx\n", (long)VM_PAGE_TO_PHYS(pg));
#if defined(UVM_PAGE_TRKOWN)
if (pg->flags & PG_BUSY)
(*pr)(" owning process = %d, tag=%s\n",
diff -r 9767011d9a3d -r 1e7bdd7d8563 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h Tue Jan 21 20:31:57 2020 +0000
+++ b/sys/uvm/uvm_page.h Tue Jan 21 20:37:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.h,v 1.96 2020/01/15 17:55:45 ad Exp $ */
+/* $NetBSD: uvm_page.h,v 1.97 2020/01/21 20:37:06 ad Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -181,7 +181,7 @@
};
/*
- * Overview of UVM page flags.
+ * Overview of UVM page flags, stored in pg->flags.
*
* Locking notes:
*
@@ -275,12 +275,9 @@
"\21PAGER1"
/*
- * uvmpdpol state flags.
+ * Flags stored in pg->pqflags, which is protected by pg->interlock.
*
- * => may only be changed with pg->interlock held.
- * => changing them is the responsibility of uvmpdpol ..
- * => .. but uvm_page needs to know about them in order to purge updates.
- * => PQ_PRIVATE is private to the individual uvmpdpol implementation.
+ * PQ_PRIVATE is for uvmpdpol to do whatever it wants with.
*/
#define PQ_INTENT_A 0x00000000 /* intend activation */
@@ -290,7 +287,12 @@
#define PQ_INTENT_MASK 0x00000003 /* mask of intended state */
#define PQ_INTENT_SET 0x00000004 /* not realized yet */
#define PQ_INTENT_QUEUED 0x00000008 /* queued for processing */
-#define PQ_PRIVATE 0xfffffff0
+#define PQ_PRIVATE 0x00000ff0 /* private for pdpolicy */
+
+#define UVM_PQFLAGBITS \
+ "\20\1INTENT_0\2INTENT_1\3INTENT_SET\4INTENT_QUEUED" \
+ "\5PRIVATE1\6PRIVATE2\7PRIVATE3\10PRIVATE4" \
+ "\11PRIVATE5\12PRIVATE6\13PRIVATE7\14PRIVATE8"
/*
* physical memory layout structure
diff -r 9767011d9a3d -r 1e7bdd7d8563 sys/uvm/uvm_pdpolicy_clock.c
--- a/sys/uvm/uvm_pdpolicy_clock.c Tue Jan 21 20:31:57 2020 +0000
+++ b/sys/uvm/uvm_pdpolicy_clock.c Tue Jan 21 20:37:06 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_pdpolicy_clock.c,v 1.30 2020/01/01 14:33:48 ad Exp $ */
+/* $NetBSD: uvm_pdpolicy_clock.c,v 1.31 2020/01/21 20:37:06 ad Exp $ */
/* NetBSD: uvm_pdaemon.c,v 1.72 2006/01/05 10:47:33 yamt Exp $ */
/*-
@@ -98,7 +98,7 @@
#else /* defined(PDSIM) */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.30 2020/01/01 14:33:48 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdpolicy_clock.c,v 1.31 2020/01/21 20:37:06 ad Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@@ -124,7 +124,6 @@
#define CLOCK_PDQ_SIZE 128
#endif /* !defined(CLOCK_PDQ_SIZE) */
-#define PQ_TIME 0xffffffc0 /* time of last activation */
#define PQ_INACTIVE 0x00000010 /* page is in inactive list */
#define PQ_ACTIVE 0x00000020 /* page is in active list */
@@ -487,29 +486,17 @@
uvmpdpol_pagedequeue_locked(pg);
TAILQ_INSERT_TAIL(&pdpol_state.s_activeq, pg, pdqueue);
pdpol_state.s_active++;
- pg->pqflags = (pg->pqflags & PQ_INTENT_QUEUED) | PQ_ACTIVE |
- (hardclock_ticks & PQ_TIME);
+ pg->pqflags = (pg->pqflags & PQ_INTENT_QUEUED) | PQ_ACTIVE;
}
void
uvmpdpol_pageactivate(struct vm_page *pg)
{
- uint32_t pqflags;
KASSERT(uvm_page_owner_locked_p(pg));
KASSERT(mutex_owned(&pg->interlock));
- /*
- * if there is any intent set on the page, or the page is not
- * active, or the page was activated in the "distant" past, then
- * it needs to be activated anew.
- */
- pqflags = pg->pqflags;
- if ((pqflags & PQ_INTENT_SET) != 0 ||
- (pqflags & PQ_ACTIVE) == 0 ||
- ((hardclock_ticks & PQ_TIME) - (pqflags & PQ_TIME)) > hz) {
- uvmpdpol_set_intent(pg, PQ_INTENT_A);
- }
+ uvmpdpol_set_intent(pg, PQ_INTENT_A);
}
static void
Home |
Main Index |
Thread Index |
Old Index