From owner-freebsd-current Thu Jan 8 05:50:28 1998 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id FAA16534 for current-outgoing; Thu, 8 Jan 1998 05:50:28 -0800 (PST) (envelope-from owner-freebsd-current) Received: from mailhub.tfs.com (tfs.com [140.145.250.1]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id FAA16526 for ; Thu, 8 Jan 1998 05:50:23 -0800 (PST) (envelope-from phk@critter.freebsd.dk) Received: from schizo.dk.tfs.com (schizo.dk.tfs.com [140.145.230.10]) by mailhub.tfs.com (8.8.8/8.8.8/ver) with ESMTP id FAA01510; Thu, 8 Jan 1998 05:39:06 -0800 (PST) Received: from critter.freebsd.dk (critter.dk.tfs.com [140.145.230.252]) by schizo.dk.tfs.com (8.8.7/8.7.3) with ESMTP id OAA07175; Thu, 8 Jan 1998 14:45:25 +0100 (MET) Received: from critter.freebsd.dk (localhost.dk.tfs.com [127.0.0.1]) by critter.freebsd.dk (8.8.7/8.8.7) with ESMTP id OAA01140; Thu, 8 Jan 1998 14:42:10 +0100 (CET) (envelope-from phk@critter.freebsd.dk) To: Dmitrij Tejblum cc: freebsd-current@FreeBSD.ORG Subject: Re: Almost memory leak in getnewvnode In-reply-to: Your message of "Thu, 08 Jan 1998 14:55:25 +0300." <199801081155.OAA17797@tejblum.dnttm.rssi.ru> Date: Thu, 08 Jan 1998 14:42:10 +0100 Message-ID: <1138.884266930@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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."