Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/uebayasi-xip]: src/sys Split physical device segment pages from "managed...
details: https://anonhg.NetBSD.org/src/rev/2fad8560c319
branches: uebayasi-xip
changeset: 751832:2fad8560c319
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Thu Nov 04 08:47:36 2010 +0000
description:
Split physical device segment pages from "managed" to "managed
device". Cache that information as a flag PG_DEVICE so that callers
don't need to walk physsegs everytime.
Remove PQ_FIXED, which means that page daemon doesn't need to know
device segment pages at all. But still fault handlers need to know
them.
I think this is what I can do best now.
diffstat:
sys/arch/m68k/m68k/pmap_motorola.c | 7 ++++---
sys/arch/mips/mips/pmap.c | 9 +++++----
sys/arch/powerpc/ibm4xx/pmap.c | 7 ++++---
sys/miscfs/genfs/genfs_io.c | 8 ++++----
sys/uvm/uvm_bio.c | 6 +++---
sys/uvm/uvm_fault.c | 8 ++++----
sys/uvm/uvm_page.c | 31 +++++++++++++++++++++----------
sys/uvm/uvm_page.h | 5 +++--
8 files changed, 48 insertions(+), 33 deletions(-)
diffs (truncated from 325 to 300 lines):
diff -r cd874344c20e -r 2fad8560c319 sys/arch/m68k/m68k/pmap_motorola.c
--- a/sys/arch/m68k/m68k/pmap_motorola.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/arch/m68k/m68k/pmap_motorola.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_motorola.c,v 1.55.2.5 2010/10/31 03:46:17 uebayasi Exp $ */
+/* $NetBSD: pmap_motorola.c,v 1.55.2.6 2010/11/04 08:47:36 uebayasi Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -119,7 +119,7 @@
#include "opt_m68k_arch.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.55.2.5 2010/10/31 03:46:17 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_motorola.c,v 1.55.2.6 2010/11/04 08:47:36 uebayasi Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -285,7 +285,8 @@
struct pv_entry *pmap_alloc_pv(void);
void pmap_free_pv(struct pv_entry *);
-#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && \
+ (uvm_pageismanaged(pa) || uvm_pageismanaged_device(pa))
static inline struct pv_header *
pa_to_pvh(paddr_t pa)
diff -r cd874344c20e -r 2fad8560c319 sys/arch/mips/mips/pmap.c
--- a/sys/arch/mips/mips/pmap.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/arch/mips/mips/pmap.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.188.2.6 2010/10/31 03:46:18 uebayasi Exp $ */
+/* $NetBSD: pmap.c,v 1.188.2.7 2010/11/04 08:47:37 uebayasi Exp $ */
/*-
* Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.188.2.6 2010/10/31 03:46:18 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.188.2.7 2010/11/04 08:47:37 uebayasi Exp $");
/*
* Manages physical address maps.
@@ -225,7 +225,8 @@
bool pmap_initialized = false;
-#define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa))
+#define PAGE_IS_MANAGED(pa) (pmap_initialized && \
+ (uvm_pageismanaged(pa) || uvm_pageismanaged_device(pa))
#define PMAP_IS_ACTIVE(pm) \
((pm) == pmap_kernel() || \
@@ -1553,7 +1554,7 @@
pmap_mmap(vaddr_t addr, off_t off)
{
- return mips_btop(vtophys(addr + off));
+ return mips_btop(MIPS_KSEG0_TO_PHYS(addr + off));
}
/*
diff -r cd874344c20e -r 2fad8560c319 sys/arch/powerpc/ibm4xx/pmap.c
--- a/sys/arch/powerpc/ibm4xx/pmap.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/arch/powerpc/ibm4xx/pmap.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.60.2.7 2010/10/31 03:46:18 uebayasi Exp $ */
+/* $NetBSD: pmap.c,v 1.60.2.8 2010/11/04 08:47:37 uebayasi Exp $ */
/*
* Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.60.2.7 2010/10/31 03:46:18 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.60.2.8 2010/11/04 08:47:37 uebayasi Exp $");
#include "opt_xip.h"
@@ -851,7 +851,8 @@
if (flags & PMAP_WIRED)
flags |= prot;
- managed = ((flags & PMAP_NOCACHE) == 0) && uvm_pageismanaged(pa);
+ managed = ((flags & PMAP_NOCACHE) == 0) &&
+ (uvm_pageismanaged(pa) || uvm_pageismanaged_device(pa));
/*
* Generate TTE.
diff -r cd874344c20e -r 2fad8560c319 sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/miscfs/genfs/genfs_io.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_io.c,v 1.36.2.28 2010/11/04 07:31:27 uebayasi Exp $ */
+/* $NetBSD: genfs_io.c,v 1.36.2.29 2010/11/04 08:47:37 uebayasi Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.28 2010/11/04 07:31:27 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.36.2.29 2010/11/04 08:47:37 uebayasi Exp $");
#include "opt_xip.h"
@@ -922,7 +922,7 @@
KASSERT((pg->flags & PG_BUSY) == 0);
KASSERT((pg->flags & PG_RDONLY) != 0);
KASSERT((pg->flags & PG_CLEAN) != 0);
- KASSERT((pg->pqflags & PQ_FIXED) != 0);
+ KASSERT((pg->flags & PG_DEVICE) != 0);
pg->flags |= PG_BUSY;
pg->flags &= ~PG_FAKE;
pg->uobject = &vp->v_uobj;
@@ -1554,7 +1554,7 @@
KASSERT((pg->flags & PG_RDONLY) != 0);
KASSERT((pg->flags & PG_CLEAN) != 0);
KASSERT((pg->flags & PG_FAKE) == 0);
- KASSERT((pg->pqflags & PQ_FIXED) != 0);
+ KASSERT((pg->flags & PG_DEVICE) != 0);
pg->flags &= ~PG_BUSY;
}
}
diff -r cd874344c20e -r 2fad8560c319 sys/uvm/uvm_bio.c
--- a/sys/uvm/uvm_bio.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/uvm/uvm_bio.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_bio.c,v 1.68.2.11 2010/08/17 06:48:14 uebayasi Exp $ */
+/* $NetBSD: uvm_bio.c,v 1.68.2.12 2010/11/04 08:47:38 uebayasi Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.68.2.11 2010/08/17 06:48:14 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.68.2.12 2010/11/04 08:47:38 uebayasi Exp $");
#include "opt_uvmhist.h"
#include "opt_ubc.h"
@@ -283,7 +283,7 @@
error = pmap_enter(ufi->orig_map->pmap, va, VM_PAGE_TO_PHYS(pg),
prot & mask, PMAP_CANFAIL | (access_type & mask));
- if (__predict_true((pg->pqflags & PQ_FIXED) == 0)) {
+ if (__predict_true((pg->flags & PG_DEVICE) == 0)) {
mutex_enter(&uvm_pageqlock);
uvm_pageactivate(pg);
mutex_exit(&uvm_pageqlock);
diff -r cd874344c20e -r 2fad8560c319 sys/uvm/uvm_fault.c
--- a/sys/uvm/uvm_fault.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/uvm/uvm_fault.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_fault.c,v 1.166.2.22 2010/08/17 06:48:14 uebayasi Exp $ */
+/* $NetBSD: uvm_fault.c,v 1.166.2.23 2010/11/04 08:47:38 uebayasi Exp $ */
/*
*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.166.2.22 2010/08/17 06:48:14 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.166.2.23 2010/11/04 08:47:38 uebayasi Exp $");
#include "opt_uvmhist.h"
#include "opt_xip.h"
@@ -1767,7 +1767,7 @@
* for this. we can just directly enter the pages.
*/
- if (__predict_true((pg->pqflags & PQ_FIXED) == 0)) {
+ if (__predict_true((pg->flags & PG_DEVICE) == 0)) {
mutex_enter(&uvm_pageqlock);
uvm_pageenqueue(pg);
mutex_exit(&uvm_pageqlock);
@@ -2199,7 +2199,7 @@
return ERESTART;
}
- if (__predict_true((pg->pqflags & PQ_FIXED) == 0))
+ if (__predict_true((pg->flags & PG_DEVICE) == 0))
uvm_fault_lower_done(ufi, flt, uobj, anon, pg);
pg->flags &= ~(PG_BUSY|PG_FAKE|PG_WANTED);
diff -r cd874344c20e -r 2fad8560c319 sys/uvm/uvm_page.c
--- a/sys/uvm/uvm_page.c Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/uvm/uvm_page.c Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.c,v 1.153.2.58 2010/11/02 14:05:28 uebayasi Exp $ */
+/* $NetBSD: uvm_page.c,v 1.153.2.59 2010/11/04 08:47:38 uebayasi Exp $ */
/*
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.58 2010/11/02 14:05:28 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.153.2.59 2010/11/04 08:47:38 uebayasi Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -862,10 +862,9 @@
paddr_t paddr = (start + i) << PAGE_SHIFT;
pg->phys_addr = paddr;
- pg->flags |= PG_FAKE | PG_CLEAN;
+ pg->flags |= PG_FAKE | PG_CLEAN | PG_DEVICE;
if (prot == VM_PROT_READ)
pg->flags |= PG_RDONLY;
- pg->pqflags = PQ_FIXED;
#ifdef __HAVE_VM_PAGE_MD
VM_MDPAGE_INIT(&pg->mdpage, paddr);
#endif
@@ -1581,7 +1580,7 @@
pmap_zero_page(VM_PAGE_TO_PHYS(pg));
}
- KASSERT((pg->pqflags & PQ_FIXED) == 0);
+ KASSERT((pg->flags & PG_DEVICE) == 0);
return(pg);
@@ -2110,7 +2109,7 @@
{
KASSERT(mutex_owned(&uvm_pageqlock));
- KASSERT((pg->pqflags & PQ_FIXED) == 0);
+ KASSERT((pg->flags & PG_DEVICE) == 0);
KASSERT(pg->wire_count != 0 || uvmpdpol_pageisqueued_p(pg));
uvmpdpol_pagedeactivate(pg);
}
@@ -2126,7 +2125,7 @@
{
KASSERT(mutex_owned(&uvm_pageqlock));
- KASSERT((pg->pqflags & PQ_FIXED) == 0);
+ KASSERT((pg->flags & PG_DEVICE) == 0);
#if defined(READAHEAD_STATS)
if ((pg->pqflags & PQ_READAHEAD) != 0) {
uvm_ra_hit.ev_count++;
@@ -2147,7 +2146,7 @@
uvm_pagedequeue(struct vm_page *pg)
{
- KASSERT((pg->pqflags & PQ_FIXED) == 0);
+ KASSERT((pg->flags & PG_DEVICE) == 0);
if (uvmpdpol_pageisqueued_p(pg)) {
KASSERT(mutex_owned(&uvm_pageqlock));
}
@@ -2165,7 +2164,7 @@
{
KASSERT(mutex_owned(&uvm_pageqlock));
- KASSERT((pg->pqflags & PQ_FIXED) == 0);
+ KASSERT((pg->flags & PG_DEVICE) == 0);
if (pg->wire_count != 0) {
return;
}
@@ -2210,11 +2209,23 @@
{
return
- (vm_physseg_find_device(atop(pa), NULL) != -1) ||
(vm_physseg_find(atop(pa), NULL) != -1);
}
/*
+ * uvm_pageismanaged_device: test it see that a page (specified by
+ * PA) is on a managed device physcal segment.
+ */
+
+bool
+uvm_pageismanaged_device(paddr_t pa)
+{
+
+ return
+ (vm_physseg_find_device(atop(pa), NULL) != -1);
+}
+
+/*
* uvm_page_lookup_freelist: look up the free list for the specified page
*/
diff -r cd874344c20e -r 2fad8560c319 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h Thu Nov 04 07:31:27 2010 +0000
+++ b/sys/uvm/uvm_page.h Thu Nov 04 08:47:36 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.h,v 1.59.2.32 2010/10/27 14:51:30 uebayasi Exp $ */
+/* $NetBSD: uvm_page.h,v 1.59.2.33 2010/11/04 08:47:38 uebayasi Exp $ */
/*
Home |
Main Index |
Thread Index |
Old Index