From 2b2cd738933d56c0834de8f9e6708c80de6989f8 Mon Sep 17 00:00:00 2001 From: Artur Grabowski Date: Thu, 22 Mar 2001 00:31:57 +0000 Subject: Use pool for allocating vnodes. Even though vnodes are never freed (could be) this gives us big memory and kmem_map savings. --- sys/kern/vfs_subr.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 90386b2ac44..5e2e514ee17 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_subr.c,v 1.57 2001/03/21 17:05:29 art Exp $ */ +/* $OpenBSD: vfs_subr.c,v 1.58 2001/03/22 00:31:56 art Exp $ */ /* $NetBSD: vfs_subr.c,v 1.53 1996/04/22 01:39:13 christos Exp $ */ /* @@ -62,6 +62,7 @@ #include #include #include +#include #include #include @@ -120,6 +121,8 @@ static __inline__ void vputonfreelist __P((struct vnode *)); void printlockedvnodes __P((void)); #endif +struct pool vnode_pool; + /* * Initialize the vnode management data structures. */ @@ -127,6 +130,8 @@ void vntblinit() { + pool_init(&vnode_pool, sizeof(struct vnode), 0, 0, 0, "vnodes", + 0, pool_page_alloc_nointr, pool_page_free_nointr, M_VNODE); simple_lock_init(&mntvnode_slock); simple_lock_init(&mntid_slock); simple_lock_init(&spechash_slock); @@ -399,8 +404,7 @@ getnewvnode(tag, mp, vops, vpp) ((TAILQ_FIRST(listhd = &vnode_hold_list) == NULL) || toggle))) { splx(s); simple_unlock(&vnode_free_list_slock); - vp = (struct vnode *)malloc((u_long)sizeof *vp, - M_VNODE, M_WAITOK); + vp = pool_get(&vnode_pool, PR_WAITOK); bzero((char *)vp, sizeof *vp); numvnodes++; } else { -- cgit v1.2.3