Subject: Re: Memory leak?
To: Michael Graff <explorer@flame.org>
From: Bill Studenmund <wrstuden@nas.nasa.gov>
List: tech-kern
Date: 11/18/1999 14:23:56
On 18 Nov 1999, Michael Graff wrote:

> Is there any reason vnodes are kept on a private free list, rather
> than being given back to the memory pool like ffsinodes are?

As Jason mentioned, the fact that we're doing lazy reclamation is why.

We do lazy reclamation as there are a lot of times when we will re-use a
vnode. Think about the vnode for the directory "usr" in your root
filesystem. It (and its assosciated inode) got allocated the first time a
program looked in /usr. A name cache entry got allocated at the same time.
Once that name lookup was done, the vnode went onto the free list. Then
next time a path lookup crossed /usr, that vnode was reactivated, used,
and then put on the free list. Lazy reclamation permits us to not need to
read the disk each name lookup. ;-)

VOP_INACTIVE happens when a vnode goes on the free list, and VOP_RECLAIM
happens when it comes off to be used as something else.

Take care,

Bill