Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 May 2001 16:10:52 -0700
From:      "Brian O'Shea" <boshea@ricochet.net>
To:        freebsd-questions@freebsd.org
Subject:   tail(1) uses kqueue, which doesn't seem to work on NFS filesystems
Message-ID:  <20010515161052.O1813@shaolin.hq.netapp.com>

next in thread | raw e-mail | index | archive | help
Hello,

I have noticed that the tail(1) command uses kevent(2) to poll a file
when the -f option is specified.  This works great for files on UFS
filesystems, however when the file is on an NFS mounted volume, tail
spins, consuming much CPU time.  Is there an option to tail that causes
it to not use kevent?

Running tail -f on a UFS filesystem:
load: 0.19  cmd: tail 62159 [kqread] 0.00u 0.00s 0% 364k

Running tail -f on a NFS filesystem:
load: 0.86  cmd: tail 62546 [running] 12.66u 74.50s 96% 376k

I noticed in the code for tail(1) (src/usr.bin/tail/forward.c) that
there is a local variable in the forward() function called "action"
which seems to control weather or not tail uses sleep or kqueue (it
seems to be assigned one of three values at various times, defined
respectively to be USE_SLEEP, USE_KQUEUE, and ADD_EVENTS).  However, it
isn't clear to me from looking at the code if this variable can be used
to disable the use of kqueue.

Thanks,
-brian

p.s.  I realize the inherent value of the kqueue/kevent interface,
however in this particular case (and I suspect I'm not alone), many of
the files that I have to deal with are on NFS mounted volumes (I work
for a storage company; eating our own dogfood and all that...).

-- 
Brian O'Shea
<boshea@ricochet.net>

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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