From owner-freebsd-hackers@FreeBSD.ORG Thu May 12 20:05:03 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11FA61065673; Thu, 12 May 2011 20:05:03 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 649A88FC08; Thu, 12 May 2011 20:05:02 +0000 (UTC) Received: by wyf23 with SMTP id 23so1956286wyf.13 for ; Thu, 12 May 2011 13:05:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=l6QziDMGEwtKQVCshdNDK6CRgsfv2CHRAkXUj7Y+R2o=; b=RK/fsQcO4IXjDsFdSUdaLXB7X9HdkWQTAtclw+1t5X2qZONxeLfSStONeRWJpQTiW4 Z/9vaxhbQTvUNIEG4ILUCXwxwjRtrbXTWHdFFf+mS6zgs3Cxp4lEh6/NtYKH8dcCGntZ XwFa9RGsjONJx/XVMkh2lonwOLgbu4XYrgO3o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=mUMm5j6TvYyo5xYSC6//HGzhqPA9GyxzVVut1lX+imah4prx3BOZKy16QkYvKPkjF6 E4NYQYYXcPqnO9w+bBF6yb13YmciSy1K08/eN5fvU/oSa+lonr2AWUgbQh6PzH2+Rnhb d3s7/+msQdnnmv6qGMsm+ET3KxgnD/dWgAbck= MIME-Version: 1.0 Received: by 10.216.220.150 with SMTP id o22mr621333wep.59.1305230701035; Thu, 12 May 2011 13:05:01 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.216.172.196 with HTTP; Thu, 12 May 2011 13:05:00 -0700 (PDT) In-Reply-To: <1367664809.20110512235200@serebryakov.spb.ru> References: <1649118429.20110512113812@serebryakov.spb.ru> <20110512111752.GP48734@deviant.kiev.zoral.com.ua> <1367664809.20110512235200@serebryakov.spb.ru> Date: Thu, 12 May 2011 13:05:00 -0700 X-Google-Sender-Auth: pPdB4Fzybp36iQCCqFkzJQ-mrr0 Message-ID: From: mdf@FreeBSD.org To: Lev Serebryakov Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: Kostik Belousov , freebsd-hackers@freebsd.org, Lev Serebryakov Subject: Re: Does FreeBSD have replacement for posix_fadvice() or fcntl(F_RDADVISE)? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 May 2011 20:05:03 -0000 2011/5/12 Lev Serebryakov : > Hello, Mdf. > You wrote 12 =D0=BC=D0=B0=D1=8F 2011 =D0=B3., 15:40:25: > >>>> =C2=A0 =C2=A0Does FreeBSD have some custom call, which can be used whe= re Linux >>>> =C2=A0programs uses posix_fadvice() and DARWIN ones fcntl(F_RDADVISE)? >>>> >>>> =C2=A0 =C2=A0It is like madvise(2) but for file descriptors. >>> No, it does not (and I think the function is spelled posix_fadvise()). >>> >>> mdf reserved the syscall slot for posix_fadvise in his recent work >>> on posix_fallocate(). Might be, he could comment more. >> Whoops, I replied bot forgot to reply-all. > >> Adding a stub for posix_fadvise() is on my list of things to do, since >> we use it at $WORK in our custom filesystem, but the list is long and >> spare time is short. > >> Nominally a technically correct implementation can do error checking >> and then nothing. =C2=A0Even after a stub is added to the OS, each >> filesystem must implement a VOP to do the work. > =C2=A0transmission Torrents client rely on this syscall. It could be beui= lt > without it, of course (it is in our ports!), but it seems, that it > produce much more sane disk load on Linux, because uses pre-fetch via > posix_fadvise(). My profiling shows that pread() could take about 40% > of it CPU time (8 seconds out of 20 with turned on ktrace, for > example), even if throughput is very modest (700KiB/s, for example). > Authors say, that they didn't observe such behavior on Linux (which > has posix_fadvise()) or MacOS X (with fcntl(F_RDADVISE))... > > =C2=A0May be, we should go to fs@ with this thread now? Probably; the interface and a few unit tests are a start but the common filesystems (presumably ufs and zfs and perhaps others) will need support and I do not have any knowledge of the internals of those filesystems. Cheers, matthew