From owner-freebsd-arch@FreeBSD.ORG Wed May 28 12:56:27 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9073A37B401 for ; Wed, 28 May 2003 12:56:27 -0700 (PDT) Received: from park.rambler.ru (park.rambler.ru [81.19.64.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2047643F3F for ; Wed, 28 May 2003 12:56:26 -0700 (PDT) (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 h4SJuOmF050926; Wed, 28 May 2003 23:56:24 +0400 (MSD) Date: Wed, 28 May 2003 23:56:24 +0400 (MSD) From: Igor Sysoev X-Sender: is@is To: Bill Fenner In-Reply-To: <200305281755.h4SHtbu05504@windsor.research.att.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: arch@freebsd.org Subject: Re: sendfile(2) SF_NOPUSH flag proposal X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 19:56:27 -0000 On Wed, 28 May 2003, Bill Fenner wrote: > Why not set PRUS_MORETOCOME on all but the final pru_send() call? I think it's a good solution. We can 1) use TF_NOPUSH to coalesce the header and the first file part or the last file part and the trailer as Matthew Dillon suggested; 2) use the same TF_NOPUSH to postpone the sending partial packet while a reading file page from the disk; 3) and use PRUS_MORETOCOME to avoid partial packet after EAGAIN on non-blocking socket. ---------- sendfile() { saved = tp->t_flags & TF_NOPUSH; if (header) { writev(header); } if (file) { send file pages with PRUS_MORETOCOME } if (trailer) { writev(trailer); } done: if (sendfile completed) { tp->t_flags &= ~TF_MORETOCOME; } tp->t_flags |= saved; if (saved & TF_NOPUSH) { tcp_output(tp); } } ---------- As I understand TF_MORETOCOME should postpone the sending the partially filled packet after sendfile will return EAGAIN. Igor Sysoev http://sysoev.ru/en/