From owner-freebsd-hackers@FreeBSD.ORG Mon Dec 12 17:23:20 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org 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 639FA16A41F for ; Mon, 12 Dec 2005 17:23:20 +0000 (GMT) (envelope-from ced@grumly.eu.org) Received: from spike.grumly.eu.org (spike.grumly.eu.org [195.5.253.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 07A7643D55 for ; Mon, 12 Dec 2005 17:23:19 +0000 (GMT) (envelope-from ced@grumly.eu.org) Received: by spike.grumly.eu.org (Postfix, from userid 1001) id 6CE3F1159E; Mon, 12 Dec 2005 18:20:31 +0100 (CET) Date: Mon, 12 Dec 2005 18:20:31 +0100 From: Cedric Tabary To: freebsd-hackers@freebsd.org Message-ID: <20051212172031.GC42322@efrei.fr> References: <20051212083930.GC91837@efrei.fr> <20051212083537.T78724@odysseus.silby.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20051212083537.T78724@odysseus.silby.com> Subject: Re: mmap() sendfile() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Dec 2005 17:23:20 -0000 On 12/12/2005 08:38, Mike Silbersack wrote: > On Mon, 12 Dec 2005, Cedric Tabary wrote: > > >If it is true, doing a sendfile() on some very big files (even if not > >keeping the descriptor open after) will kill the cache ? > > > >Please help me to understand why this patch ? and the difference between > >sendfile() and mmap() at the memory or cache level.. > > > >Cédric > > My memory escapes me on all the details, but there were two potential > reasons not to use sendfile with 4.x that no longer apply in 5.x and > above: > > 1. Sendfile used to send small files inefficiently, sending the http > headers in one packet and the data in another. I fixed this in 5.x. > > 2. Alan Cox improved the memory efficiency of sendfile greatly, it now > uses a single kernel buffer for all copies of the same block of the same > file, whereas the old implementation made an in-kernel copy of each block, > making it no more memory efficient than using mbufs. What about using sendfile() or mmap() on NFS ? Cédric