Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jul 2013 11:44:32 -0700
From:      Scott Long <scottl@samsco.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Adrian Chadd <adrian@freebsd.org>, freebsd-current <freebsd-current@freebsd.org>
Subject:   Re: hacking - aio_sendfile()
Message-ID:  <D722FEF8-158D-44C1-A701-87095750CF07@samsco.org>
In-Reply-To: <20130711061753.GK91021@kib.kiev.ua>
References:  <CAJ-Vmo=icr6bda%2BWMNUarc3WbdqJ%2BMdauX6kByxxdTx8oSovBg@mail.gmail.com> <20130711061753.GK91021@kib.kiev.ua>

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

On Jul 10, 2013, at 11:17 PM, Konstantin Belousov <kostikbel@gmail.com> =
wrote:

> On Wed, Jul 10, 2013 at 04:36:23PM -0700, Adrian Chadd wrote:
>> Hiya,
>>=20
>> I've started writing an aio_sendfile() syscall.
>>=20
>> http://people.freebsd.org/~adrian/ath/20130710-aio-sendfile-3.diff
>>=20
>> Yes, the diff is against -HEAD and not stable/9.
>>=20
>> It's totally horrible, hackish and likely bad. I've only done some
>> very, very basic testing to ensure it actually works; i haven't at =
all
>> stress tested it out yet. It's also very naive - I'm not at all doing
>> any checks to see whether I can short-cut to do the aio there and
>> then; I'm always queuing the sendfile() op through the worker =
threads.
>> That's likely stupid and inefficient in a lot of cases, but it at
>> least gets the syscall up and working.
> Yes, it is naive, but for different reason.
>=20
> The kern_sendfile() is synchronous function, it only completes after
> the other end of the network communication allows it. This means
> that calling kern_sendfile() from the aio thread blocks the thread
> indefinitely by unbounded sleep.


No, kern_sendfile is async unless you specify the SF_SYNC hack flag.
Otherwise, it'll fill the socket buffer and then return immediately, =
unless
the socket buffer is full and the socket is set to blocking mode.  =
That's
outside the scope, as I said in my previous email.

Scott




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?D722FEF8-158D-44C1-A701-87095750CF07>