Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Jan 1998 14:42:10 +0100
From:      Poul-Henning Kamp <phk@critter.freebsd.dk>
To:        Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Almost memory leak in getnewvnode 
Message-ID:  <1138.884266930@critter.freebsd.dk>
In-Reply-To: Your message of "Thu, 08 Jan 1998 14:55:25 %2B0300." <199801081155.OAA17797@tejblum.dnttm.rssi.ru> 

next in thread | previous in thread | raw e-mail | index | archive | help

I'm currently trying to convince John Dyson that he shouldn't put things
on the freelist unless he wants them there.  That would eliminate this
entire tmp_list thing.

I pressume John will do something about this problem one way or another.

Poul-Henning


In message <199801081155.OAA17797@tejblum.dnttm.rssi.ru>, Dmitrij Tejblum write
s:
>getnewvnode() very rare reuse vnodes from the freelist and allocate a new 
>vnode instead. It is because the way it use to move vnodes to the end of 
>the freelist is too simple. The following patch reduced number of vnodes in 
>my 
>system in several times.
>
>--- vfs_subr.c.00	Wed Jan  7 18:55:36 1998
>+++ vfs_subr.c	Thu Jan  8 14:08:13 1998
>@@ -373,7 +373,8 @@
> 		 */
> 		vp = NULL;
> 	} else {
>-		TAILQ_FOREACH(vp, &vnode_free_list, v_freelist) {
>+		for(vp = TAILQ_FIRST(&vnode_free_list); vp; vp = tvp) {
>+			tvp = TAILQ_NEXT(vp, v_freelist);
> 			if (!simple_lock_try(&vp->v_interlock)) 
> 				continue;
> 			if (vp->v_usecount)
>@@ -395,7 +396,7 @@
> 		}
> 	}
> 
>-	TAILQ_FOREACH(tvp, &vnode_tmp_list, v_freelist) {
>+	while(tvp = TAILQ_FIRST(&vnode_tmp_list)) {
> 		TAILQ_REMOVE(&vnode_tmp_list, tvp, v_freelist);
> 		TAILQ_INSERT_TAIL(&vnode_free_list, tvp, v_freelist);
> 		simple_unlock(&tvp->v_interlock);
>
>
>
>

--
Poul-Henning Kamp             FreeBSD coreteam member
phk@FreeBSD.ORG               "Real hackers run -current on their laptop."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1138.884266930>