Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Add vm page flag PG_MARKER and use it to tag dummy marke...
details: https://anonhg.NetBSD.org/src/rev/f4a314cf2e12
branches: trunk
changeset: 756698:f4a314cf2e12
user: hannken <hannken%NetBSD.org@localhost>
date: Thu Jul 29 10:54:50 2010 +0000
description:
Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.
Ok: YAMAMOTO Takashi <yamt%netbsd.org@localhost>
diffstat:
sys/arch/sparc64/sparc64/pmap.c | 5 +++--
sys/kern/vfs_subr.c | 8 ++++----
sys/miscfs/genfs/genfs_io.c | 24 ++++++++++++++----------
sys/rump/librump/rumpkern/vm.c | 5 +++--
sys/ufs/lfs/lfs_vnops.c | 14 +++++++++-----
sys/uvm/uvm_aobj.c | 14 ++++++--------
sys/uvm/uvm_page.h | 5 +++--
7 files changed, 42 insertions(+), 33 deletions(-)
diffs (257 lines):
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.264 2010/05/18 04:30:16 mrg Exp $ */
+/* $NetBSD: pmap.c,v 1.265 2010/07/29 10:54:50 hannken Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.264 2010/05/18 04:30:16 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.265 2010/07/29 10:54:50 hannken Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@@ -1444,6 +1444,7 @@
/* we could be a little smarter and leave pages zeroed */
for (pg = TAILQ_FIRST(&pm->pm_obj.memq); pg != NULL; pg = nextpg) {
+ KASSERT((pg->flags & PG_MARKER) == 0);
nextpg = TAILQ_NEXT(pg, listq.queue);
TAILQ_REMOVE(&pm->pm_obj.memq, pg, listq.queue);
KASSERT(pg->mdpage.mdpg_pvh.pv_pmap == NULL);
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/kern/vfs_subr.c Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_subr.c,v 1.413 2010/07/28 11:03:47 hannken Exp $ */
+/* $NetBSD: vfs_subr.c,v 1.414 2010/07/29 10:54:50 hannken Exp $ */
/*-
* Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.413 2010/07/28 11:03:47 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.414 2010/07/29 10:54:50 hannken Exp $");
#include "opt_ddb.h"
#include "opt_compat_netbsd.h"
@@ -1136,7 +1136,7 @@
if (LIST_NEXT(bp, b_vnbufs) != NOLIST)
bufremvn(bp);
- if (TAILQ_EMPTY(&vp->v_uobj.memq) && (vp->v_iflag & VI_ONWORKLST) &&
+ if (vp->v_uobj.uo_npages == 0 && (vp->v_iflag & VI_ONWORKLST) &&
LIST_FIRST(&vp->v_dirtyblkhd) == NULL) {
vp->v_iflag &= ~VI_WRMAPDIRTY;
vn_syncer_remove_from_worklist(vp);
@@ -1176,7 +1176,7 @@
*/
if ((bp->b_oflags & BO_DELWRI) == 0) {
listheadp = &vp->v_cleanblkhd;
- if (TAILQ_EMPTY(&vp->v_uobj.memq) &&
+ if (vp->v_uobj.uo_npages == 0 &&
(vp->v_iflag & VI_ONWORKLST) &&
LIST_FIRST(&vp->v_dirtyblkhd) == NULL) {
vp->v_iflag &= ~VI_WRMAPDIRTY;
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/miscfs/genfs/genfs_io.c
--- a/sys/miscfs/genfs/genfs_io.c Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/miscfs/genfs/genfs_io.c Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: genfs_io.c,v 1.36 2010/01/30 12:06:20 uebayasi Exp $ */
+/* $NetBSD: genfs_io.c,v 1.37 2010/07/29 10:54:50 hannken 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 2010/01/30 12:06:20 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.37 2010/07/29 10:54:50 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -891,12 +891,8 @@
dirtygen = gp->g_dirtygen;
freeflag = pagedaemon ? PG_PAGEOUT : PG_RELEASED;
if (by_list) {
- curmp.uobject = uobj;
- curmp.offset = (voff_t)-1;
- curmp.flags = PG_BUSY;
- endmp.uobject = uobj;
- endmp.offset = (voff_t)-1;
- endmp.flags = PG_BUSY;
+ curmp.flags = PG_MARKER;
+ endmp.flags = PG_MARKER;
pg = TAILQ_FIRST(&uobj->memq);
TAILQ_INSERT_TAIL(&uobj->memq, &endmp, listq.queue);
} else {
@@ -909,14 +905,19 @@
* if the current page is not interesting, move on to the next.
*/
- KASSERT(pg == NULL || pg->uobject == uobj);
+ KASSERT(pg == NULL || pg->uobject == uobj ||
+ (pg->flags & PG_MARKER) != 0);
KASSERT(pg == NULL ||
(pg->flags & (PG_RELEASED|PG_PAGEOUT)) == 0 ||
- (pg->flags & PG_BUSY) != 0);
+ (pg->flags & (PG_BUSY|PG_MARKER)) != 0);
if (by_list) {
if (pg == &endmp) {
break;
}
+ if (pg->flags & PG_MARKER) {
+ pg = TAILQ_NEXT(pg, listq.queue);
+ continue;
+ }
if (pg->offset < startoff || pg->offset >= endoff ||
pg->flags & (PG_RELEASED|PG_PAGEOUT)) {
if (pg->flags & (PG_RELEASED|PG_PAGEOUT)) {
@@ -1186,6 +1187,9 @@
(vp->v_iflag & VI_ONWORKLST) != 0) {
#if defined(DEBUG)
TAILQ_FOREACH(pg, &uobj->memq, listq.queue) {
+ if ((pg->flags & PG_MARKER) != 0) {
+ continue;
+ }
if ((pg->flags & PG_CLEAN) == 0) {
printf("%s: %p: !CLEAN\n", __func__, pg);
}
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/rump/librump/rumpkern/vm.c
--- a/sys/rump/librump/rumpkern/vm.c Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/rump/librump/rumpkern/vm.c Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm.c,v 1.84 2010/06/14 21:04:56 pooka Exp $ */
+/* $NetBSD: vm.c,v 1.85 2010/07/29 10:54:50 hannken Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.84 2010/06/14 21:04:56 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.85 2010/07/29 10:54:50 hannken Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -459,6 +459,7 @@
struct vm_page *pg;
TAILQ_FOREACH(pg, &uobj->memq, listq.queue) {
+ KASSERT((pg->flags & PG_MARKER) == 0);
if (pg->offset == off) {
return pg;
}
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/ufs/lfs/lfs_vnops.c
--- a/sys/ufs/lfs/lfs_vnops.c Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/ufs/lfs/lfs_vnops.c Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_vnops.c,v 1.229 2010/06/24 13:03:19 hannken Exp $ */
+/* $NetBSD: lfs_vnops.c,v 1.230 2010/07/29 10:54:51 hannken Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.229 2010/06/24 13:03:19 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.230 2010/07/29 10:54:51 hannken Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1848,12 +1848,16 @@
* blocks outside our area of interest or beyond
* the end of file.
*/
+ KASSERT((curpg->flags & PG_MARKER) == 0);
if (pages_per_block > 1) {
while (curpg &&
- ((curpg->offset & fs->lfs_bmask) ||
- curpg->offset >= vp->v_size ||
- curpg->offset >= endoffset))
+ ((curpg->offset & fs->lfs_bmask) ||
+ curpg->offset >= vp->v_size ||
+ curpg->offset >= endoffset)) {
curpg = TAILQ_NEXT(curpg, listq.queue);
+ KASSERT(curpg == NULL ||
+ (curpg->flags & PG_MARKER) == 0);
+ }
}
if (curpg == NULL)
break;
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/uvm/uvm_aobj.c
--- a/sys/uvm/uvm_aobj.c Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/uvm/uvm_aobj.c Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_aobj.c,v 1.109 2010/05/28 23:41:14 rmind Exp $ */
+/* $NetBSD: uvm_aobj.c,v 1.110 2010/07/29 10:54:51 hannken Exp $ */
/*
* Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.109 2010/05/28 23:41:14 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.110 2010/07/29 10:54:51 hannken Exp $");
#include "opt_uvmhist.h"
@@ -789,12 +789,8 @@
* genfs_putpages() also.
*/
- curmp.uobject = uobj;
- curmp.offset = (voff_t)-1;
- curmp.flags = PG_BUSY;
- endmp.uobject = uobj;
- endmp.offset = (voff_t)-1;
- endmp.flags = PG_BUSY;
+ curmp.flags = PG_MARKER;
+ endmp.flags = PG_MARKER;
/*
* now do it. note: we must update nextpg in the body of loop or we
@@ -817,6 +813,8 @@
if (pg == &endmp)
break;
nextpg = TAILQ_NEXT(pg, listq.queue);
+ if (pg->flags & PG_MARKER)
+ continue;
if (pg->offset < start || pg->offset >= stop)
continue;
} else {
diff -r d4b7364b8c5d -r f4a314cf2e12 sys/uvm/uvm_page.h
--- a/sys/uvm/uvm_page.h Thu Jul 29 08:16:49 2010 +0000
+++ b/sys/uvm/uvm_page.h Thu Jul 29 10:54:50 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_page.h,v 1.59 2010/02/06 12:10:59 uebayasi Exp $ */
+/* $NetBSD: uvm_page.h,v 1.60 2010/07/29 10:54:51 hannken Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -180,12 +180,13 @@
#define PG_FAKE 0x0040 /* page is not yet initialized */
#define PG_RDONLY 0x0080 /* page must be mapped read-only */
#define PG_ZERO 0x0100 /* page is pre-zero'd */
+#define PG_MARKER 0x0200 /* dummy marker page */
#define PG_PAGER1 0x1000 /* pager-specific flag */
#define UVM_PGFLAGBITS \
"\20\1BUSY\2WANTED\3TABLED\4CLEAN\5PAGEOUT\6RELEASED\7FAKE\10RDONLY" \
- "\11ZERO\15PAGER1"
+ "\11ZERO\12MARKER\15PAGER1"
#define PQ_FREE 0x0001 /* page is on free list */
#define PQ_ANON 0x0002 /* page is part of an anon, rather
Home |
Main Index |
Thread Index |
Old Index