Re: File trees: the deeper, the weirder



On Sun, Oct 29, 2006 at 11:32:58AM -0500, Matt Emmerton wrote:
[ Restoring some OP context.]

On Sun, Oct 29, 2006 at 05:07:16PM +0300, Yar Tikhiy wrote:

As for the said program, it keeps its 1 Hz pace, mostly waiting on
"vlruwk". It's killable, after a delay. The system doesn't show ...

Weird, eh? Any ideas what's going on?

I would guess that you need a new vnode to create the new file, but no
vnodes are obvious candidates for freeing because they all have a child
directory in use. Is there some sort of vnode clearing that goes on every
second if we are short of vnodes?

See sys/vfs_subr.c, subroutine getnewvnode(). We call msleep() if we're
waiting on vnodes to be created (or recycled). And just look at the 'hz'
parameter passed to msleep()!

The calling process's mkdir() will end up waiting in getnewvnode() (in
"vlruwk" state) while the vnlru kernel thread does it's thing (which is to
recycle vnodes.)

Either the vnlru kernel thread has to work faster, or the caller has to
sleep less, in order to avoid this lock-step behaviour.

I'm afraid that, though your analysis is right, you arrive at wrong
conclusions. The process waits for the whole second in getnewvnode()
because the vnlru thread cannot free as much vnodes as it wants to.
vnlru_proc() will wake up sleepers on vnlruproc_sig (i.e.,
getnewvnode()) only if (numvnodes <= desiredvnodes * 9 / 10).
Whether this condition is attainable depends on vlrureclaim() (called
from the vnlru thread) freeing vnodes at a sufficient rate. Perhaps
vlrureclaim() just can't keep the pace at this conditions.
debug.vnlru_nowhere increasing is an indication of that. Consequently,
each getnewvnode() call sleeps 1 second, then grabs a vnode beyond
desiredvnodes. It's no surprise that the 1 second delays start to
appear after approx. kern.maxvnodes directories were created.

Yar
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: Freeing vnodes.
    ... :> enough vnodes to have 'wantfreevnodes' worth of slop so getnewvnode() ... to have tens of thousands of free vnodes. ... This load can easily outstrip vnlru_proc's ...
    (freebsd-arch)
  • Re: Freeing vnodes.
    ... I haven't seen my machine even get to 10,000 free vnodes with this patch ... > for freeing up vnodes for getnewvnode(). ... >:them, so at most you're freeing an inode for a deleted file, and in the ... > In the current pre-patch case, that read load was distributed over ALL ...
    (freebsd-arch)
  • Re: Freeing vnodes.
    ... :that allows us to start reclaiming vnodes from the free list and release ... It also changes the semantics of wantfreevnodes, ... enough vnodes to have 'wantfreevnodes' worth of slop so getnewvnode() ... having a more dynamic goal that is based on the load on getnewvnode. ...
    (freebsd-arch)
  • Re: File trees: the deeper, the weirder
    ... It's killable, after a delay. ... vnodes are obvious candidates for freeing because they all have a child ... See sys/vfs_subr.c, subroutine getnewvnode(). ... Either the vnlru kernel thread has to work faster, ...
    (freebsd-hackers)
  • Re: File trees: the deeper, the weirder
    ... It's killable, after a delay. ... vnodes are obvious candidates for freeing because they all have a child ... See sys/vfs_subr.c, subroutine getnewvnode(). ... Either the vnlru kernel thread has to work faster, ...
    (freebsd-hackers)