Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Sep 2009 10:40:27 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        d@delphij.net
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: fcntl(F_RDAHEAD)
Message-ID:  <20090918074027.GI47688@deviant.kiev.zoral.com.ua>
In-Reply-To: <4AB2B7A1.5000601@delphij.net>
References:  <20090917101526.GF57619@rambler-co.ru> <4AB2B7A1.5000601@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--iWiB/3aOFpG2Ko/s
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Sep 17, 2009 at 03:26:41PM -0700, Xin LI wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>=20
> Hi, Igor,
>=20
> Igor Sysoev wrote:
> > Hi,
> >=20
> > nginx-0.8.15 can use completely non-blocking sendfile() using SF_NODISK=
IO
> > flag. When sendfile() returns EBUSY, nginx calls aio_read() to read sin=
gle
> > byte. The first aio_read() preloads the first 128K part of a file in VM=
 cache,
> > however, all successive aio_read()s preload just 16K parts of the file.
> > This makes non-blocking sendfile() usage ineffective for files larger
> > than 128K.
> >=20
> > I've created a small patch for Darwin compatible F_RDAHEAD fcntl:
> >=20
> >    fcntl(fd, F_RDAHEAD, preload_size)
> >=20
> > There is small incompatibilty: Darwin's fcntl allows just to enable/dis=
able
> > read ahead, while the proposed patch allows to set exact preload size.
> >=20
> > Currently the preload size affects vn_read() code path only and does not
> > affect on sendfile() code path. However, it can be easy extended on
> > sendfile() part too. The preload size is still limited by sysctl vfs.re=
ad_max.
> >=20
> > The patch is against FreeBSD 7.2 and was tested on FreeBSD 7.2-STABLE o=
nly.
>=20
> I have ported this as a patch against -HEAD (should apply on 8.0-R but
> it's too late for us to add a new feature) plus a manual page entry
> documenting the feature.
>=20
> I've used F_READAHEAD as the name, but reading the manual page, it looks
> like we can just use F_RDAHEAD since Darwin seems to just distinguish 0
> and !=3D0 case so that programmers won't have to use #ifdef or something
> else to get code working on different platform?

What I dislike about the patch is the new kernel-private flag that is
eaten from the open(2) flags namespace. We do already have FHASLOCK,
so far the only such flag.

--iWiB/3aOFpG2Ko/s
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (FreeBSD)

iEYEARECAAYFAkqzOWsACgkQC3+MBN1Mb4jncwCg9zvfscnUBgH4Jsu1g/vRDRaJ
En4An1ZLbdjiRLaEOqhvEUmRoCrP8pq3
=mP+3
-----END PGP SIGNATURE-----

--iWiB/3aOFpG2Ko/s--



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