From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 5 01:31:25 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8894016A4CE for ; Wed, 5 Nov 2003 01:31:25 -0800 (PST) Received: from park.rambler.ru (park.rambler.ru [81.19.64.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id BF64D43FEC for ; Wed, 5 Nov 2003 01:31:23 -0800 (PST) (envelope-from is@rambler-co.ru) Received: from is.park.rambler.ru (is.park.rambler.ru [81.19.64.102]) by park.rambler.ru (8.12.6/8.12.6) with ESMTP id hA59VEJ6095448; Wed, 5 Nov 2003 12:31:14 +0300 (MSK) (envelope-from is@rambler-co.ru) Date: Wed, 5 Nov 2003 12:31:14 +0300 (MSK) From: Igor Sysoev X-Sender: is@is.park.rambler.ru To: Mike Silbersack In-Reply-To: <20031105022737.J1370@odysseus.silby.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org cc: Vivek Pai cc: Alan Cox Subject: Re: Update: Debox sendfile modifications X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Nov 2003 09:31:25 -0000 On Wed, 5 Nov 2003, Mike Silbersack wrote: > On Wed, 5 Nov 2003, Vivek Pai wrote: > > > If you were to have sendfile issue the disk reads, how would you signal > > completion? I guess one approach is to make the socket buffer appear to > > have no space while the sendfile-initiated read is in progress, but > > it seems to me that such an approach would be considered too ugly. It > > would cause the least modification to applications, because otherwise > > apps need to disable interest on the socket having space, and re-enable > > it after getting notified that the sendfile-initiated read (and > > transfer) completed. Am I missing something? > > > > -Vivek > > I'm not quite certain how I would do it yet. At this point in time I'm > just brainstorming. I have some other things I'd like to work on in the > next few weeks, I'll sit down and think about this more in late November / > early December if I'm still in the right mindset. I think it can done in the following way - a socket should have flag that says that sendfile() had started the reading a page. select()/poll()/kevent() should check this flag before the checking a socket buffer space. When the page had been read this flag is reset. If there was error while a reading a page then second flag should be set and the first one should be reset. sendfile() should check the error flag before processing. If it set then sendfile() should do a blocking read() to learn errno. I think that this blocking read() would not occur under normal conditions and would not decrease perfomance. And if we have file errors we should think not about perfomance but about correctness of a whole server. I think it would be transparent to the existent user applications that uses select()/etc. As to worker kthreads I think it's better to queue aio operation as it was made in src/sys/kern/vfs_aio.c:aio_qphysio(). Igor Sysoev http://sysoev.ru/en/