From owner-freebsd-current@FreeBSD.ORG Sun Jun 20 22:52:18 2004 Return-Path: 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 A0A7F16A4CE; Sun, 20 Jun 2004 22:52:18 +0000 (GMT) Received: from aldan.algebra.com (aldan.algebra.com [216.254.65.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 36B0A43D39; Sun, 20 Jun 2004 22:52:18 +0000 (GMT) (envelope-from mi@aldan.algebra.com) Received: from aldan.algebra.com (mi@localhost [127.0.0.1]) by aldan.algebra.com (8.12.11/8.12.11) with ESMTP id i5KMqB8m029175 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 20 Jun 2004 18:52:11 -0400 (EDT) (envelope-from mi@aldan.algebra.com) Received: by aldan.algebra.com (8.12.11/8.12.11/Submit) id i5KMqArv029174; Sun, 20 Jun 2004 18:52:10 -0400 (EDT) (envelope-from mi) From: Mikhail Teterin To: Matthew Dillon Date: Sun, 20 Jun 2004 18:52:08 -0400 User-Agent: KMail/1.6.2 References: <200406200343.03920@aldan> <200406201835.i5KIZBeJ026532@apollo.backplane.com> In-Reply-To: <200406201835.i5KIZBeJ026532@apollo.backplane.com> X-Face: %UW#n0|w>ydeGt/b@1-.UFP=K^~-:0f#O:D7whJ5G_<5143Bb3kOIs9XpX+"V+~$adGP:J|SLieM31VIhqXeLBli" X-Mailman-Approved-At: Mon, 21 Jun 2004 11:53:21 +0000 cc: questions@freebsd.org cc: current@freebsd.org Subject: Re: read vs. mmap (or io vs. page faults) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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: Sun, 20 Jun 2004 22:52:18 -0000 On Sunday 20 June 2004 02:35 pm, you wrote: = = :I this how things are supposed to be, or will mmap() become more = :efficient eventually? Thanks! = : = : -mi = It's hard to say. mmap() could certainly be made more efficient, e.g. = by faulting in more pages at a time to reduce the actual fault rate. = But it's fairly difficult to beat a read copy into a small buffer. Well, that's the thing -- by mmap-ing the whole file at once (and by madvise-ing with MADV_SEQUENTIONAL), I thought, I told, the kernel everything it needed to know to make the best decision. Why can't page-faulting code do a better job using all this knowledge, than the poor read, which only knows about the partial read in question? I find it so disappointing, that it can, probably, be considered a bug. I'll try this code on Linux and Solaris. If mmap is better there (as it really ought to be), we have a problem, IMHO. Thanks! -mi