From owner-freebsd-current@FreeBSD.ORG Thu Jul 11 09:56:23 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id D65212AE; Thu, 11 Jul 2013 09:56:23 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) by mx1.freebsd.org (Postfix) with ESMTP id 661F71EDC; Thu, 11 Jul 2013 09:56:23 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.7/8.14.7) with ESMTP id r6B9uFZV084522; Thu, 11 Jul 2013 12:56:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua r6B9uFZV084522 Received: (from kostik@localhost) by tom.home (8.14.7/8.14.7/Submit) id r6B9uF63084521; Thu, 11 Jul 2013 12:56:15 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 11 Jul 2013 12:56:15 +0300 From: Konstantin Belousov To: Adrian Chadd Subject: Re: hacking - aio_sendfile() Message-ID: <20130711095615.GM91021@kib.kiev.ua> References: <20130711061753.GK91021@kib.kiev.ua> <20130711093630.GL91021@kib.kiev.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5A5licVS1j+RWz1s" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on tom.home Cc: freebsd-current X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jul 2013 09:56:23 -0000 --5A5licVS1j+RWz1s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 11, 2013 at 02:39:00AM -0700, Adrian Chadd wrote: > On 11 July 2013 02:36, Konstantin Belousov wrote: >=20 > > No, it is not disk I/O which is problematic there. It is socket I/O > > e.g. wait for the socket buffers lomark in the kern_sendfile() which > > causes unbounded sleep. Look for the sbwait() call, both in the > > kern_sendfile() itself, and in the pru_send methods of the protocols, > > e.g. in sosend_generic(). The wait scope controlled by the other side of > > connection and allow it to completely block the aio subsystem. > > > > Disk I/O is supposed to finish in the finite time. >=20 > Even if the destination socket is marked as NONBLOCK? You mean, would a sleep for the socket buffer space cause aio thread block is the socket is put in nonblocking mode ? Or something else ? No, it would not block the thread. But I cannot consider the aio_sendfile(2) implementation useful if it requires non-blocking socket. Also, what about other thread changing the socket to blocking mode while sendfile is in flight ? --5A5licVS1j+RWz1s Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQIcBAEBAgAGBQJR3oE/AAoJEJDCuSvBvK1BQoAQAKhbJwA4NzJFbCkYUGgnO2CY 0c0NTia6bqUhHNCHhWPDyhHE5J0JpyUQLmARA1mSzLpwzy/g/b62gcm2tyxHt625 iYmbzT1sU0AOuWjLhM7KjWo3ekKkueniQEY78kXbNAYCVt7Fa8XXyz5t4UcDQFBv IR6xqdsaq12Sk/nL7d6S6g/vAkaE2tTr71KxUskhFzi61SRdIpT3sV/Moy/C3UxE +6ZUvpliN90oen2/iudVC6Yao0y4kma/4cFTVznHZ4hB8SlzdxSvH5CHZH3sr8Q8 73f4agB+b2W3SUH/746CTmZBFYXsHDmvZyIqsf1VjG4toJq4dYKiyK9WhQs1tYNE V63pE1OWWi1Aa7k5XpwFff0wDAQwzI245r2+Gi6Axt2Id6+LUTR56jEFjggH/3z2 go2aBf8FJVBAfi6TUldhusKLynpMV0cwU3Xp427mnAF5dw5w4yOlSCTo/TIarreH RQFJn5arECjb1IFfZzXZx4wXPTSH/UbEdaa2W2NYsPfFPg6SKRIP9nG3uriMOaOP MONvakr95uVmc4j2ElJ9rCg4apNp/eFEucwB1gVLcXPFiUn/APUDMpaxxDAJuTWG cCwCzpx/MaLGW5vvp5C2vZ5lWE53y5a7Ew2ozM/Q70U/2meB6mmj67X7k4XB0BgN bgXXLx2/4txXNW4E6Ott =d5Be -----END PGP SIGNATURE----- --5A5licVS1j+RWz1s--