Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpkern Use standard uvm aobj pager. Most...
details: https://anonhg.NetBSD.org/src/rev/2397df68336e
branches: trunk
changeset: 757594:2397df68336e
user: pooka <pooka%NetBSD.org@localhost>
date: Mon Sep 06 20:10:20 2010 +0000
description:
Use standard uvm aobj pager. Most of the kernel aobj pager complexity
comes from swap handling, but that is included only with VMSWAP.
diffstat:
sys/rump/librump/rumpkern/Makefile.rumpkern | 4 +-
sys/rump/librump/rumpkern/rump.c | 5 +-
sys/rump/librump/rumpkern/vm.c | 109 +++------------------------
3 files changed, 18 insertions(+), 100 deletions(-)
diffs (208 lines):
diff -r 9aa22d19f1f8 -r 2397df68336e sys/rump/librump/rumpkern/Makefile.rumpkern
--- a/sys/rump/librump/rumpkern/Makefile.rumpkern Mon Sep 06 20:03:56 2010 +0000
+++ b/sys/rump/librump/rumpkern/Makefile.rumpkern Mon Sep 06 20:10:20 2010 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.rumpkern,v 1.96 2010/09/01 19:37:58 pooka Exp $
+# $NetBSD: Makefile.rumpkern,v 1.97 2010/09/06 20:10:20 pooka Exp $
#
.include "${RUMPTOP}/Makefile.rump"
@@ -95,7 +95,7 @@
syscalls.c
# sys/uvm
-SRCS+= uvm_readahead.c
+SRCS+= uvm_aobj.c uvm_readahead.c
# 4.4BSD secmodel. selection is hardcoded for now
SRCS+= secmodel_suser.c
diff -r 9aa22d19f1f8 -r 2397df68336e sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c Mon Sep 06 20:03:56 2010 +0000
+++ b/sys/rump/librump/rumpkern/rump.c Mon Sep 06 20:10:20 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rump.c,v 1.184 2010/09/01 19:37:58 pooka Exp $ */
+/* $NetBSD: rump.c,v 1.185 2010/09/06 20:10:20 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.184 2010/09/01 19:37:58 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.185 2010/09/06 20:10:20 pooka Exp $");
#include <sys/systm.h>
#define ELFSIZE ARCH_ELFSIZE
@@ -293,6 +293,7 @@
kmem_init();
uvm_ra_init();
+ uao_init();
mutex_obj_init();
callout_startup();
diff -r 9aa22d19f1f8 -r 2397df68336e sys/rump/librump/rumpkern/vm.c
--- a/sys/rump/librump/rumpkern/vm.c Mon Sep 06 20:03:56 2010 +0000
+++ b/sys/rump/librump/rumpkern/vm.c Mon Sep 06 20:10:20 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm.c,v 1.87 2010/07/29 15:13:00 hannken Exp $ */
+/* $NetBSD: vm.c,v 1.88 2010/09/06 20:10:20 pooka Exp $ */
/*
* Copyright (c) 2007-2010 Antti Kantee. All Rights Reserved.
@@ -30,9 +30,7 @@
*/
/*
- * Virtual memory emulation routines. Contents:
- * + anon objects & pager
- * + misc support routines
+ * Virtual memory emulation routines.
*/
/*
@@ -43,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.87 2010/07/29 15:13:00 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.88 2010/09/06 20:10:20 pooka Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -60,21 +58,14 @@
#include <uvm/uvm.h>
#include <uvm/uvm_ddb.h>
+#include <uvm/uvm_pdpolicy.h>
#include <uvm/uvm_prot.h>
#include <uvm/uvm_readahead.h>
#include "rump_private.h"
-static int ao_get(struct uvm_object *, voff_t, struct vm_page **,
- int *, int, vm_prot_t, int, int);
-static int ao_put(struct uvm_object *, voff_t, voff_t, int);
-
-const struct uvm_pagerops aobj_pager = {
- .pgo_get = ao_get,
- .pgo_put = ao_put,
-};
-
kmutex_t uvm_pageqlock;
+kmutex_t uvm_swap_data_lock;
struct uvmexp uvmexp;
struct uvm uvm;
@@ -149,88 +140,6 @@
}
/*
- * Anon object stuff
- */
-
-static int
-ao_get(struct uvm_object *uobj, voff_t off, struct vm_page **pgs,
- int *npages, int centeridx, vm_prot_t access_type,
- int advice, int flags)
-{
- struct vm_page *pg;
- int i;
-
- if (centeridx)
- panic("%s: centeridx != 0 not supported", __func__);
-
- /* loop over pages */
- off = trunc_page(off);
- for (i = 0; i < *npages; i++) {
- retrylookup:
- pg = uvm_pagelookup(uobj, off + (i << PAGE_SHIFT));
- if (pg) {
- if (pg->flags & PG_BUSY) {
- pg->flags |= PG_WANTED;
- UVM_UNLOCK_AND_WAIT(pg, &uobj->vmobjlock, 0,
- "aogetpg", 0);
- goto retrylookup;
- }
- pg->flags |= PG_BUSY;
- pgs[i] = pg;
- } else {
- pg = uvm_pagealloc(uobj,
- off + (i << PAGE_SHIFT), NULL, UVM_PGA_ZERO);
- pgs[i] = pg;
- }
- }
- mutex_exit(&uobj->vmobjlock);
-
- return 0;
-
-}
-
-static int
-ao_put(struct uvm_object *uobj, voff_t start, voff_t stop, int flags)
-{
- struct vm_page *pg;
-
- /* we only free all pages for now */
- if ((flags & PGO_FREE) == 0 || (flags & PGO_ALLPAGES) == 0) {
- mutex_exit(&uobj->vmobjlock);
- return 0;
- }
-
- while ((pg = TAILQ_FIRST(&uobj->memq)) != NULL)
- uvm_pagefree(pg);
- mutex_exit(&uobj->vmobjlock);
-
- return 0;
-}
-
-struct uvm_object *
-uao_create(vsize_t size, int flags)
-{
- struct uvm_object *uobj;
-
- uobj = kmem_zalloc(sizeof(struct uvm_object), KM_SLEEP);
- uobj->pgops = &aobj_pager;
- TAILQ_INIT(&uobj->memq);
- mutex_init(&uobj->vmobjlock, MUTEX_DEFAULT, IPL_NONE);
-
- return uobj;
-}
-
-void
-uao_detach(struct uvm_object *uobj)
-{
-
- mutex_enter(&uobj->vmobjlock);
- ao_put(uobj, 0, 0, PGO_ALLPAGES | PGO_FREE);
- mutex_destroy(&uobj->vmobjlock);
- kmem_free(uobj, sizeof(*uobj));
-}
-
-/*
* Misc routines
*/
@@ -260,6 +169,7 @@
mutex_init(&pagermtx, MUTEX_DEFAULT, 0);
mutex_init(&uvm_pageqlock, MUTEX_DEFAULT, 0);
+ mutex_init(&uvm_swap_data_lock, MUTEX_DEFAULT, 0);
mutex_init(&pdaemonmtx, MUTEX_DEFAULT, 0);
cv_init(&pdaemoncv, "pdaemon");
@@ -762,6 +672,13 @@
/* nada */
}
+void
+uvmpdpol_anfree(struct vm_anon *an)
+{
+
+ /* nada */
+}
+
/*
* Routines related to the Page Baroness.
*/
Home |
Main Index |
Thread Index |
Old Index