Re: about the vnode free list

From: Konstantin Belousov <kib_at_freebsd.org>
Date: Tue, 31 Oct 2023 00:53:26 UTC
On Mon, Oct 30, 2023 at 08:41:05AM +0000, YU SHANG wrote:
> Hi guys,
> I'm reading the man page of getnewvnode which says that the vnode is either freshly allocated or taken from the free list. What I can't understand is where is the free list,is it the vnode_list? Many thanks.
> 

There is indeed no free list.  For the long time, really unused vnode is
freed back to UMA.

The global vnode list contains vnodes that have the identity, this way the
filesystem' data cache is implemented.  When system needs a spare vnode and
the total vnode limit is reached, vnlru frees some cached vnode that seems
to be unused.  Read the code starting from vn_alloc(), there were recently
some rototiling of the code.