Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/rmind-uvmplock]: src/sys Implement sharing of vnode_t::v_interlock among...
details: https://anonhg.NetBSD.org/src/rev/738dd9808a7f
branches: rmind-uvmplock
changeset: 753084:738dd9808a7f
user: rmind <rmind%NetBSD.org@localhost>
date: Thu May 19 03:42:58 2011 +0000
description:
Implement sharing of vnode_t::v_interlock amongst vnodes:
- Lock is shared amongst UVM objects using uvm_obj_setlock() or getnewvnode().
- Adjust vnode cache to handle unsharing, add VI_LOCKSHARE flag for that.
- Use sharing in tmpfs and layerfs for underlying object.
- Simplify locking in ubc_fault().
- Sprinkle some asserts.
Discussed with ad@.
diffstat:
sys/arch/arm/arm32/pmap.c | 19 ++++++----
sys/arch/hppa/hppa/pmap.c | 17 ++++++---
sys/arch/sparc64/sparc64/pmap.c | 13 +++++--
sys/arch/x86/include/pmap.h | 4 +-
sys/arch/x86/x86/pmap.c | 15 +++++--
sys/arch/xen/xen/privcmd.c | 8 ++--
sys/coda/coda_vnops.c | 6 +-
sys/fs/adosfs/advfsops.c | 6 +-
sys/fs/cd9660/cd9660_vfsops.c | 7 ++-
sys/fs/efs/efs_vfsops.c | 6 +-
sys/fs/filecorefs/filecore_vfsops.c | 8 ++--
sys/fs/hfs/hfs_vfsops.c | 8 ++-
sys/fs/msdosfs/msdosfs_denode.c | 9 ++--
sys/fs/nilfs/nilfs_subr.c | 6 +-
sys/fs/ntfs/ntfs_vfsops.c | 10 ++--
sys/fs/ptyfs/ptyfs_subr.c | 7 ++-
sys/fs/puffs/puffs_node.c | 9 ++--
sys/fs/smbfs/smbfs_node.c | 6 +-
sys/fs/smbfs/smbfs_vfsops.c | 6 +-
sys/fs/sysvbfs/sysvbfs_vfsops.c | 8 ++--
sys/fs/tmpfs/tmpfs_subr.c | 10 ++++-
sys/fs/tmpfs/tmpfs_vnops.c | 16 ++++-----
sys/fs/udf/udf_subr.c | 12 +++---
sys/fs/union/union_subr.c | 6 +-
sys/fs/union/union_vnops.c | 32 ++++++++----------
sys/fs/unionfs/unionfs_subr.c | 2 +-
sys/fs/unionfs/unionfs_vnops.c | 41 ++++++++++++++++-------
sys/kern/vfs_subr.c | 6 +-
sys/kern/vfs_vnode.c | 35 +++++++++++++++++--
sys/miscfs/fdesc/fdesc_vnops.c | 6 +-
sys/miscfs/genfs/layer_subr.c | 8 ++-
sys/miscfs/genfs/layer_vnops.c | 32 ++++++++----------
sys/miscfs/kernfs/kernfs_subr.c | 10 +++--
sys/miscfs/procfs/procfs_subr.c | 10 +++--
sys/miscfs/syncfs/sync_vnops.c | 11 +++--
sys/nfs/nfs_node.c | 6 +-
sys/rump/librump/rumpvfs/rumpfs.c | 6 +-
sys/sys/vnode.h | 5 +-
sys/ufs/ext2fs/ext2fs_vfsops.c | 7 ++-
sys/ufs/ffs/ffs_vfsops.c | 7 ++-
sys/ufs/lfs/lfs_syscalls.c | 7 ++-
sys/ufs/lfs/lfs_vfsops.c | 7 ++-
sys/ufs/lfs/lfs_vnops.c | 16 +++++----
sys/ufs/mfs/mfs_vfsops.c | 6 +-
sys/uvm/uvm_aobj.c | 19 ++++++----
sys/uvm/uvm_bio.c | 64 +++++++++++++++---------------------
sys/uvm/uvm_device.c | 10 ++--
sys/uvm/uvm_extern.h | 7 ++-
sys/uvm/uvm_fault.c | 26 +++++++-------
sys/uvm/uvm_loan.c | 9 ++--
sys/uvm/uvm_object.c | 57 +++++++++++++++++++++-----------
51 files changed, 379 insertions(+), 295 deletions(-)
diffs (truncated from 2075 to 300 lines):
diff -r 46e9d2726b06 -r 738dd9808a7f sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/arch/arm/arm32/pmap.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.212.2.5 2011/04/21 01:40:51 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.212.2.6 2011/05/19 03:42:58 rmind Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -211,7 +211,7 @@
#include <machine/param.h>
#include <arm/arm32/katelib.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.212.2.5 2011/04/21 01:40:51 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.212.2.6 2011/05/19 03:42:58 rmind Exp $");
#ifdef PMAP_DEBUG
@@ -2727,7 +2727,10 @@
pm = pool_cache_get(&pmap_cache, PR_WAITOK);
- uvm_obj_init(&pm->pm_obj, NULL, &pm->pm_obj_lock, 1);
+ mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&pm->pm_obj, NULL, false, 1);
+ uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock);
+
pm->pm_stats.wired_count = 0;
pm->pm_stats.resident_count = 1;
pm->pm_cstate.cs_all = 0;
@@ -4380,9 +4383,8 @@
if (pmap_recent_user == pm)
pmap_recent_user = NULL;
- uvm_obj_destroy(&pm->pm_obj, &pm->pm_obj_lock);
-
- /* return the pmap to the pool */
+ uvm_obj_destroy(&pm->pm_obj, false);
+ mutex_destroy(&pm->pm_obj_lock);
pool_cache_put(&pmap_cache, pm);
}
@@ -5142,7 +5144,10 @@
pm->pm_domain = PMAP_DOMAIN_KERNEL;
pm->pm_activated = true;
pm->pm_cstate.cs_all = PMAP_CACHE_STATE_ALL;
- uvm_obj_init(&pm->pm_obj, NULL, &pm->pm_obj_lock, 1);
+
+ mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&pm->pm_obj, NULL, false, 1);
+ uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock);
/*
* Scan the L1 translation table created by initarm() and create
diff -r 46e9d2726b06 -r 738dd9808a7f sys/arch/hppa/hppa/pmap.c
--- a/sys/arch/hppa/hppa/pmap.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/arch/hppa/hppa/pmap.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.71.2.5 2011/03/09 19:13:18 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.71.2.6 2011/05/19 03:42:59 rmind Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.71.2.5 2011/03/09 19:13:18 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.71.2.6 2011/05/19 03:42:59 rmind Exp $");
#include "opt_cputype.h"
@@ -679,7 +679,10 @@
kpm = pmap_kernel();
memset(kpm, 0, sizeof(*kpm));
- uvm_obj_init(&kpm->pm_obj, NULL, &kpm->pm_obj_lock, 1);
+ mutex_init(&kpm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&kpm->pm_obj, NULL, false, 1);
+ uvm_obj_setlock(&kpm->pm_obj, &kpm->pm_obj_lock);
+
kpm->pm_space = HPPA_SID_KERNEL;
kpm->pm_pid = HPPA_PID_KERNEL;
kpm->pm_pdir_pg = NULL;
@@ -1039,7 +1042,9 @@
DPRINTF(PDB_FOLLOW|PDB_PMAP, ("%s: pmap = %p\n", __func__, pmap));
- uvm_obj_init(&pmap->pm_obj, NULL, &pmap->pm_obj_lock, 1);
+ mutex_init(&pmap->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&pmap->pm_obj, NULL, false, 1);
+ uvm_obj_setlock(&pmap->pm_obj, &pmap->pm_obj_lock);
mutex_enter(&pmaps_lock);
@@ -1142,8 +1147,8 @@
pmap_pagefree(pmap->pm_pdir_pg);
mutex_exit(pmap->pm_lock);
- uvm_obj_destroy(&pmap->pm_obj, &pmap->pm_obj_lock);
- pmap->pm_pdir_pg = NULL;
+ uvm_obj_destroy(&pmap->pm_obj, false);
+ mutex_destroy(&pmap->pm_obj_lock);
pool_put(&pmap_pool, pmap);
}
diff -r 46e9d2726b06 -r 738dd9808a7f sys/arch/sparc64/sparc64/pmap.c
--- a/sys/arch/sparc64/sparc64/pmap.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/arch/sparc64/sparc64/pmap.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.259.2.4 2011/04/11 04:35:27 mrg Exp $ */
+/* $NetBSD: pmap.c,v 1.259.2.5 2011/05/19 03:42:59 rmind Exp $ */
/*
*
* Copyright (C) 1996-1999 Eduardo Horvath.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.259.2.4 2011/04/11 04:35:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.259.2.5 2011/05/19 03:42:59 rmind Exp $");
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
#define HWREF
@@ -1375,7 +1375,10 @@
memset(pm, 0, sizeof *pm);
DPRINTF(PDB_CREATE, ("pmap_create(): created %p\n", pm));
- uvm_obj_init(&pm->pm_obj, NULL, &pm->pm_obj_lock, 1);
+ mutex_init(&pm->pm_obj_lock, MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&pm->pm_obj, NULL, false, 1);
+ uvm_obj_setlock(&pm->pm_obj, &pm->pm_obj_lock);
+
if (pm != pmap_kernel()) {
while (!pmap_get_page(&pm->pm_physaddr)) {
uvm_wait("pmap_create");
@@ -1450,7 +1453,9 @@
uvm_pagefree(pg);
}
pmap_free_page((paddr_t)(u_long)pm->pm_segs, pmap_cpus_active);
- uvm_obj_destroy(&pm->pm_obj, &pm->pm_obj_lock);
+
+ uvm_obj_destroy(&pm->pm_obj, false);
+ mutex_destroy(&pm->pm_obj_lock);
pool_cache_put(&pmap_cache, pm);
}
diff -r 46e9d2726b06 -r 738dd9808a7f sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/arch/x86/include/pmap.h Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.29.2.9 2011/03/17 04:46:28 rmind Exp $ */
+/* $NetBSD: pmap.h,v 1.29.2.10 2011/05/19 03:42:59 rmind Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -135,7 +135,7 @@
struct pmap {
struct uvm_object pm_obj[PTP_LEVELS-1]; /* objects for lvl >= 1) */
#define pm_lock pm_obj[0].vmobjlock
- kmutex_t pm_obj_lock[PTP_LEVELS-1]; /* locks for pm_objs, XXXrmind */
+ kmutex_t pm_obj_lock[PTP_LEVELS-1]; /* locks for pm_objs */
LIST_ENTRY(pmap) pm_list; /* list (lck by pm_list lock) */
pd_entry_t *pm_pdir; /* VA of PD (lck by object lock) */
paddr_t pm_pdirpa[PDP_SIZE]; /* PA of PDs (read-only after create) */
diff -r 46e9d2726b06 -r 738dd9808a7f sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/arch/x86/x86/pmap.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.105.2.14 2011/04/21 01:41:33 rmind Exp $ */
+/* $NetBSD: pmap.c,v 1.105.2.15 2011/05/19 03:42:59 rmind 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.105.2.14 2011/04/21 01:41:33 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.105.2.15 2011/05/19 03:42:59 rmind Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -1212,7 +1212,9 @@
kpm = pmap_kernel();
for (i = 0; i < PTP_LEVELS - 1; i++) {
- uvm_obj_init(&kpm->pm_obj[i], NULL, &kpm->pm_obj_lock[i], 1);
+ mutex_init(&kpm->pm_obj_lock[i], MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&kpm->pm_obj[i], NULL, false, 1);
+ uvm_obj_setlock(&kpm->pm_obj[i], &kpm->pm_obj_lock[i]);
kpm->pm_ptphint[i] = NULL;
}
memset(&kpm->pm_list, 0, sizeof(kpm->pm_list)); /* pm_list not used */
@@ -2142,7 +2144,9 @@
/* init uvm_object */
for (i = 0; i < PTP_LEVELS - 1; i++) {
- uvm_obj_init(&pmap->pm_obj[i], NULL, &pmap->pm_obj_lock[i], 1);
+ mutex_init(&pmap->pm_obj_lock[i], MUTEX_DEFAULT, IPL_NONE);
+ uvm_obj_init(&pmap->pm_obj[i], NULL, false, 1);
+ uvm_obj_setlock(&pmap->pm_obj[i], &pmap->pm_obj_lock[i]);
pmap->pm_ptphint[i] = NULL;
}
pmap->pm_stats.wired_count = 0;
@@ -2314,7 +2318,8 @@
#endif
for (i = 0; i < PTP_LEVELS - 1; i++) {
- uvm_obj_destroy(&pmap->pm_obj[i], &pmap->pm_obj_lock[i]);
+ uvm_obj_destroy(&pmap->pm_obj[i], false);
+ mutex_destroy(&pmap->pm_obj_lock[i]);
}
pool_cache_put(&pmap_cache, pmap);
}
diff -r 46e9d2726b06 -r 738dd9808a7f sys/arch/xen/xen/privcmd.c
--- a/sys/arch/xen/xen/privcmd.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/arch/xen/xen/privcmd.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.41.4.1 2010/03/16 15:38:04 rmind Exp $ */
+/* $NetBSD: privcmd.c,v 1.41.4.2 2011/05/19 03:43:00 rmind Exp $ */
/*-
* Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.41.4.1 2010/03/16 15:38:04 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.41.4.2 2011/05/19 03:43:00 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -474,7 +474,7 @@
}
mutex_exit(uobj->vmobjlock);
kmem_free(pobj->maddr, sizeof(paddr_t) * pobj->npages);
- uvm_obj_destroy(uobj, NULL);
+ uvm_obj_destroy(uobj, true);
kmem_free(pobj, sizeof(struct privcmd_object));
privcmd_nobjects--;
}
@@ -563,7 +563,7 @@
}
privcmd_nobjects++;
- uvm_obj_init(&obj->uobj, &privpgops, NULL, 1);
+ uvm_obj_init(&obj->uobj, &privpgops, true, 1);
mutex_enter(obj->uobj.vmobjlock);
obj->maddr = maddr;
obj->npages = npages;
diff -r 46e9d2726b06 -r 738dd9808a7f sys/coda/coda_vnops.c
--- a/sys/coda/coda_vnops.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/coda/coda_vnops.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: coda_vnops.c,v 1.71.4.3 2011/03/05 20:52:37 rmind Exp $ */
+/* $NetBSD: coda_vnops.c,v 1.71.4.4 2011/05/19 03:43:00 rmind Exp $ */
/*
*
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.71.4.3 2011/03/05 20:52:37 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vnops.c,v 1.71.4.4 2011/05/19 03:43:00 rmind Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1915,7 +1915,7 @@
cp = coda_alloc();
cp->c_fid = *fid;
- err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, &vp);
+ err = getnewvnode(VT_CODA, vfsp, coda_vnodeop_p, NULL, &vp);
if (err) {
panic("coda: getnewvnode returned error %d", err);
}
diff -r 46e9d2726b06 -r 738dd9808a7f sys/fs/adosfs/advfsops.c
--- a/sys/fs/adosfs/advfsops.c Sat Apr 23 15:35:25 2011 +0000
+++ b/sys/fs/adosfs/advfsops.c Thu May 19 03:42:58 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: advfsops.c,v 1.59.4.1 2010/07/03 01:19:49 rmind Exp $ */
+/* $NetBSD: advfsops.c,v 1.59.4.2 2011/05/19 03:43:00 rmind Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.59.4.1 2010/07/03 01:19:49 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advfsops.c,v 1.59.4.2 2011/05/19 03:43:00 rmind Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -362,7 +362,7 @@
if ((*vpp = adosfs_ahashget(mp, an)) != NULL)
return (0);
Home |
Main Index |
Thread Index |
Old Index