Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/yamt-pagecache]: src page cache related changes
details: https://anonhg.NetBSD.org/src/rev/dfd109a41614
branches: yamt-pagecache
changeset: 770815:dfd109a41614
user: yamt <yamt%NetBSD.org@localhost>
date: Wed Nov 02 21:53:56 2011 +0000
description:
page cache related changes
- maintain object pages in radix tree rather than rb tree.
- reduce unnecessary page scan in putpages. esp. when an object has a ton of
pages cached but only a few of them are dirty.
- reduce the number of pmap operations by tracking page dirtiness more
precisely in uvm layer.
- fix nfs commit range tracking.
- fix nfs write clustering. XXX hack
diffstat:
distrib/sets/lists/comp/mi | 3 +-
etc/Makefile | 8 +-
external/bsd/iscsi/dist/src/lib/libiscsi.3 | 3 +-
share/man/man4/mpls.4 | 5 +-
sys/arch/x68k/include/cdefs.h | 2 +-
sys/arch/x68k/include/cpufunc.h | 2 +-
sys/arch/x68k/include/ieeefp.h | 2 +-
sys/arch/x68k/include/profile.h | 2 +-
sys/arch/x68k/include/setjmp.h | 2 +-
sys/arch/x68k/usr.bin/Makefile | 2 +-
sys/arch/x86/x86/pmap.c | 84 ++++-
sys/kern/init_main.c | 6 +-
sys/lib/libkern/Makefile.libkern | 4 +-
sys/miscfs/genfs/genfs_io.c | 362 ++++++++++++++++-----------
sys/nfs/nfs_bio.c | 12 +-
sys/nfs/nfs_subs.c | 40 +-
sys/rump/librump/rumpkern/Makefile.rumpkern | 3 +-
sys/rump/librump/rumpkern/rump.c | 6 +-
sys/rump/librump/rumpkern/vm.c | 57 +--
sys/rump/librump/rumpvfs/vm_vfs.c | 16 +-
sys/ufs/lfs/lfs_segment.c | 7 +-
sys/ufs/lfs/lfs_vfsops.c | 7 +-
sys/ufs/lfs/lfs_vnops.c | 15 +-
sys/ufs/ufs/ufs_inode.c | 12 +-
sys/uvm/files.uvm | 4 +-
sys/uvm/uvm_anon.c | 6 +-
sys/uvm/uvm_aobj.c | 30 +-
sys/uvm/uvm_bio.c | 19 +-
sys/uvm/uvm_fault.c | 54 ++--
sys/uvm/uvm_km.c | 26 +-
sys/uvm/uvm_loan.c | 19 +-
sys/uvm/uvm_object.c | 12 +-
sys/uvm/uvm_object.h | 14 +-
sys/uvm/uvm_page.c | 188 +++++++++----
sys/uvm/uvm_page.h | 41 ++-
sys/uvm/uvm_page_array.c | 163 ++++++++++++
sys/uvm/uvm_page_array.h | 68 +++++
sys/uvm/uvm_page_status.c | 155 +++++++++++
sys/uvm/uvm_pager.c | 10 +-
sys/uvm/uvm_pdaemon.c | 24 +-
sys/uvm/uvm_vnode.c | 14 +-
41 files changed, 1058 insertions(+), 451 deletions(-)
diffs (truncated from 3079 to 300 lines):
diff -r 0a18d06545e9 -r dfd109a41614 distrib/sets/lists/comp/mi
--- a/distrib/sets/lists/comp/mi Wed Nov 02 16:54:50 2011 +0000
+++ b/distrib/sets/lists/comp/mi Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1702 2011/11/01 13:37:32 yamt Exp $
+# $NetBSD: mi,v 1.1702.2.1 2011/11/02 21:53:56 yamt Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -2466,6 +2466,7 @@
./usr/include/sys/queue.h comp-c-include
./usr/include/sys/quota.h comp-c-include
./usr/include/sys/radioio.h comp-c-include
+./usr/include/sys/radixtree.h comp-c-include
./usr/include/sys/ras.h comp-c-include
./usr/include/sys/rb.h comp-obsolete obsolete
./usr/include/sys/rbtree.h comp-c-include
diff -r 0a18d06545e9 -r dfd109a41614 etc/Makefile
--- a/etc/Makefile Wed Nov 02 16:54:50 2011 +0000
+++ b/etc/Makefile Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.393 2011/11/02 16:39:23 yamt Exp $
+# $NetBSD: Makefile,v 1.392 2011/08/22 18:54:05 jym Exp $
# from: @(#)Makefile 8.7 (Berkeley) 5/25/95
# Environment variables without default values:
@@ -189,11 +189,11 @@
MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
MKBFD MKBINUTILS MKCATPAGES \
MKCRYPTO MKCRYPTO_IDEA MKCRYPTO_MDC2 MKCRYPTO_RC5 MKCVS \
- MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \
+ MKDEBUG MKDEBUGLIB MKDOC MKDYNAMICROOT \
MKGCC MKGCCCMDS MKGDB \
- MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
+ MKHESIOD MKHOSTOBJ MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
MKKERBEROS MKLDAP MKLINKLIB MKLINT \
- MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \
+ MKMAN MKMANZ MKMDNS MKNLS MKNPF MKNVI MKOBJ MKOBJDIRS \
MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
MKUNPRIVED MKUPDATE MKX11 MKYP \
diff -r 0a18d06545e9 -r dfd109a41614 external/bsd/iscsi/dist/src/lib/libiscsi.3
--- a/external/bsd/iscsi/dist/src/lib/libiscsi.3 Wed Nov 02 16:54:50 2011 +0000
+++ b/external/bsd/iscsi/dist/src/lib/libiscsi.3 Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: libiscsi.3,v 1.5 2011/11/02 16:45:00 yamt Exp $
+.\" $NetBSD: libiscsi.3,v 1.4 2011/02/20 03:56:36 agc Exp $
.\"
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -64,6 +64,7 @@
.Ft char *
.Fo iscsi_target_getvar
.Fa "iscsi_target_t *target" "const char *name"
+.Fa "iscsi_target_t *target"
.Fc
.Ft int
.Fo iscsi_initiator_set_defaults
diff -r 0a18d06545e9 -r dfd109a41614 share/man/man4/mpls.4
--- a/share/man/man4/mpls.4 Wed Nov 02 16:54:50 2011 +0000
+++ b/share/man/man4/mpls.4 Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mpls.4,v 1.7 2011/07/17 23:50:05 dholland Exp $
+.\" $NetBSD: mpls.4,v 1.7.2.1 2011/11/02 21:53:58 yamt Exp $
.\"
.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -181,7 +181,8 @@
# ifconfig mpls0 inet 192.168.0.1/32
.Ed
.It
-Route IP packets into MPLS domain with a specific tag
+Route IP packets for the subnet (10.0.0.0/8) into MPLS domain with
+a specific tag (25) and the next hop LSR (192.168.1.100).
.Bd -literal
# route add 10.0.0.0/8 -ifp mpls0 -tag 25 -inet 192.168.1.100
.Ed
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x68k/include/cdefs.h
--- a/sys/arch/x68k/include/cdefs.h Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x68k/include/cdefs.h Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cdefs.h,v 1.1 1996/05/05 12:17:15 oki Exp $ */
+/* $NetBSD: cdefs.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
#ifndef _MACHINE_CDEFS_H_
#define _MACHINE_CDEFS_H_
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x68k/include/cpufunc.h
--- a/sys/arch/x68k/include/cpufunc.h Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x68k/include/cpufunc.h Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.h,v 1.1 1996/05/05 12:17:15 oki Exp $ */
+/* $NetBSD: cpufunc.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
/*
* Functions to provide access to special cpu instructions.
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x68k/include/ieeefp.h
--- a/sys/arch/x68k/include/ieeefp.h Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x68k/include/ieeefp.h Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ieeefp.h,v 1.1 1996/05/05 12:17:14 oki Exp $ */
+/* $NetBSD: ieeefp.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
/* Just use the common m68k definition */
#include <m68k/ieeefp.h>
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x68k/include/profile.h
--- a/sys/arch/x68k/include/profile.h Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x68k/include/profile.h Wed Nov 02 21:53:56 2011 +0000
@@ -1,3 +1,3 @@
-/* $NetBSD: profile.h,v 1.1 1996/05/05 12:17:14 oki Exp $ */
+/* $NetBSD: profile.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
#include <m68k/profile.h>
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x68k/include/setjmp.h
--- a/sys/arch/x68k/include/setjmp.h Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x68k/include/setjmp.h Wed Nov 02 21:53:56 2011 +0000
@@ -1,3 +1,3 @@
-/* $NetBSD: setjmp.h,v 1.1 1996/05/05 12:17:15 oki Exp $ */
+/* $NetBSD: setjmp.h,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $ */
#include <m68k/setjmp.h>
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x68k/usr.bin/Makefile
--- a/sys/arch/x68k/usr.bin/Makefile Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x68k/usr.bin/Makefile Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 1996/05/05 12:17:17 oki Exp $
+# $NetBSD: Makefile,v 1.1.1.1 1996/05/05 12:17:03 oki Exp $
SUBDIR+= loadfont loadkmap palette rtcalarm tvctrl bellctrl
diff -r 0a18d06545e9 -r dfd109a41614 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Wed Nov 02 16:54:50 2011 +0000
+++ b/sys/arch/x86/x86/pmap.c Wed Nov 02 21:53:56 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.137 2011/10/18 23:43:06 jym Exp $ */
+/* $NetBSD: pmap.c,v 1.137.2.1 2011/11/02 21:53:58 yamt Exp $ */
/*-
* Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.137 2011/10/18 23:43:06 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.137.2.1 2011/11/02 21:53:58 yamt Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -553,8 +553,8 @@
* local prototypes
*/
-static struct vm_page *pmap_get_ptp(struct pmap *, vaddr_t,
- pd_entry_t * const *);
+static int pmap_get_ptp(struct pmap *, vaddr_t,
+ pd_entry_t * const *, struct vm_page **);
static struct vm_page *pmap_find_ptp(struct pmap *, vaddr_t, paddr_t, int);
static void pmap_freepage(struct pmap *, struct vm_page *, int);
static void pmap_free_ptp(struct pmap *, struct vm_page *,
@@ -789,6 +789,7 @@
atomic_and_32(&curpmap->pm_kernel_cpus, ~cpumask);
ci->ci_pmap = pmap;
ci->ci_tlbstate = TLBSTATE_VALID;
+ ci->ci_want_pmapload = 0;
atomic_or_32(&pmap->pm_cpus, cpumask);
atomic_or_32(&pmap->pm_kernel_cpus, cpumask);
cpu_load_pmap(pmap);
@@ -832,8 +833,15 @@
* If the pmap was already installed, we are done.
*/
ci = curcpu();
- ci->ci_tlbstate = TLBSTATE_LAZY;
- ci->ci_want_pmapload = (mypmap != pmap_kernel());
+ if (ci->ci_tlbstate == TLBSTATE_VALID) {
+ ci->ci_tlbstate = TLBSTATE_LAZY;
+ ci->ci_want_pmapload = (mypmap != pmap_kernel());
+ } else {
+ /*
+ * This can happen when undoing after pmap_get_ptp blocked.
+ */
+ printf("%s: already non-valid %u\n", __func__, ci->ci_tlbstate);
+ }
mutex_exit(pmap->pm_lock);
if (pmap == pmap2) {
return;
@@ -1873,8 +1881,9 @@
* => preemption should be disabled
*/
-static struct vm_page *
-pmap_get_ptp(struct pmap *pmap, vaddr_t va, pd_entry_t * const *pdes)
+static int
+pmap_get_ptp(struct pmap *pmap, vaddr_t va, pd_entry_t * const *pdes,
+ struct vm_page **resultp)
{
struct vm_page *ptp, *pptp;
int i;
@@ -1895,6 +1904,9 @@
* add a new page to that level.
*/
for (i = PTP_LEVELS; i > 1; i--) {
+ lwp_t *l;
+ uint64_t ncsw;
+
/*
* Save values from previous round.
*/
@@ -1911,13 +1923,29 @@
}
obj = &pmap->pm_obj[i-2];
+ l = curlwp;
PMAP_SUBOBJ_LOCK(pmap, i - 2);
+ ncsw = l->l_ncsw;
ptp = uvm_pagealloc(obj, ptp_va2o(va, i - 1), NULL,
UVM_PGA_USERESERVE|UVM_PGA_ZERO);
+ if (__predict_false(ncsw != l->l_ncsw)) {
+ /*
+ * radix_tree_insert_node, which is used by
+ * uvm_pagealloc, can block.
+ */
+ printf("%s: uvm_pagealloc blocked\n", __func__);
+ if (ptp != NULL) {
+ uvm_pagefree(ptp);
+ }
+ PMAP_SUBOBJ_UNLOCK(pmap, i - 2);
+ /* XXX shut up the assertion in pmap_unmap_ptes */
+ pmap->pm_ncsw = l->l_ncsw;
+ return EAGAIN;
+ }
PMAP_SUBOBJ_UNLOCK(pmap, i - 2);
if (ptp == NULL)
- return NULL;
+ return ENOMEM;
ptp->flags &= ~PG_BUSY; /* never busy */
ptp->wire_count = 1;
@@ -1969,7 +1997,8 @@
}
pmap->pm_ptphint[0] = ptp;
- return(ptp);
+ *resultp = ptp;
+ return 0;
}
/*
@@ -2949,15 +2978,22 @@
*/
vaddr_t
-pmap_map(vaddr_t va, paddr_t spa, paddr_t epa, vm_prot_t prot)
+pmap_map(vaddr_t sva, paddr_t spa, paddr_t epa, vm_prot_t prot)
{
- while (spa < epa) {
- pmap_kenter_pa(va, spa, prot, 0);
- va += PAGE_SIZE;
- spa += PAGE_SIZE;
+ paddr_t pa;
+ vaddr_t va;
+
+ KASSERT((prot & ~VM_PROT_ALL) == 0);
+ for (pa = spa, va = sva; pa < epa; pa += PAGE_SIZE, va += PAGE_SIZE) {
+ pt_entry_t *pte = kvtopte(va);
+ pt_entry_t npte;
+
+ npte = pmap_pa2pte(pa);
+ npte |= protection_codes[prot] | PG_k | PG_V;
+ pmap_pte_set(pte, npte);
+ pmap_update_pg(va);
}
- pmap_update(pmap_kernel());
- return va;
+ return sva;
}
/*
@@ -3862,6 +3898,11 @@
if (pmap == pmap_kernel())
npte |= pmap_pg_g;
if (flags & VM_PROT_ALL) {
+#if defined(DIAGNOSTIC)
+ if (((flags & VM_PROT_ALL) & ~prot) != 0) {
+ printf("%s: %x %x\n", __func__, flags, prot);
+ }
+#endif /* defined(DIAGNOSTIC) */
npte |= PG_U;
if (flags & VM_PROT_WRITE) {
KASSERT((npte & PG_RW) != 0);
@@ -3895,17 +3936,20 @@
}
kpreempt_disable();
+retry:
pmap_map_ptes(pmap, &pmap2, &ptes, &pdes); /* locks pmap */
if (pmap == pmap_kernel()) {
ptp = NULL;
} else {
- ptp = pmap_get_ptp(pmap, va, pdes);
- if (ptp == NULL) {
Home |
Main Index |
Thread Index |
Old Index