From owner-freebsd-current@FreeBSD.ORG Thu Sep 21 12:28:07 2006 Return-Path: X-Original-To: freebsd-current@freebsd.org Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 843EC16A47C for ; Thu, 21 Sep 2006 12:28:07 +0000 (UTC) (envelope-from garyj@jennejohn.org) Received: from mail08b.verio.de (mail08b.verio.de [213.198.55.74]) by mx1.FreeBSD.org (Postfix) with SMTP id 4854A43D49 for ; Thu, 21 Sep 2006 12:28:06 +0000 (GMT) (envelope-from garyj@jennejohn.org) Received: from mx01.stngva01.us.mxservers.net (204.202.242.3) by mail08b.verio.de (RS ver 1.0.95vs) with SMTP id 1-0823461676; Thu, 21 Sep 2006 14:28:04 +0200 (CEST) Received: from www.jennejohn.org [213.198.5.174] (EHLO peedub.jennejohn.org) by mx01.stngva01.us.mxservers.net (mxl_mta-1.3.8-10p4) with ESMTP id c4582154.18911.156.mx01.stngva01.us.mxservers.net; Thu, 21 Sep 2006 08:27:56 -0400 (EDT) Received: from jennejohn.org (localhost [127.0.0.1]) by peedub.jennejohn.org (8.13.7/8.11.6) with ESMTP id k8LCRWFR000879; Thu, 21 Sep 2006 14:27:32 +0200 (CEST) (envelope-from garyj@jennejohn.org) Message-Id: <200609211227.k8LCRWFR000879@peedub.jennejohn.org> X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.0.4 To: alc@FreeBSD.org From: Gary Jennejohn Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 21 Sep 2006 14:27:31 +0200 Sender: garyj@jennejohn.org X-Spam: [F=0.3724412528; heur=0.500(-6600); stat=0.372; spamtraq-heur=0.500(2006092024)] X-MAIL-FROM: X-SOURCE-IP: [213.198.5.174] X-Loop-Detect: 1 X-DistLoop-Detect: 1 Cc: freebsd-current@FreeBSD.org Subject: Re: Much improved sendfile(2) kernel implementation X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 21 Sep 2006 12:28:07 -0000 On Wed, Sep 20, 2006 at 11:59:13PM +0200, Andre Oppermann wrote: > I have rewritten kern_sendfile() to work in two loops, the inner which turns > as many pages into mbufs as it can up to the free send socket buffer space. > The outer loop then drops the whole mbuf chain into the send socket buffer, > calls tcp_output() on it and then waits until 50% of the socket buffer are > free again to repeat the cycle. This way tcp_output() gets the full amount > of data to work with and can issue up to 64K sends for TSO to chop up in the > network adapter without using any CPU cycles. Thus it gets very efficient > especially with the readahead the VM and I/O system do. > > The patch is available here: > http://people.freebsd.org/~andre/sendfile-20060920.diff > My vesion of gcc (3.4.4) doesn't like the omin() macro. I had to change it to this: #define omin(a, b) ((off_t)a < (off_t)b ? (off_t)a : (off_t)b) Otherwise I haven't seen any catastrophies yet, but it's only been running for a few minutes ;-) -- Gary Jennejohn / garyjATjennejohnDOTorg gjATfreebsdDOTorg garyjATdenxDOTde