From owner-freebsd-stable@FreeBSD.ORG Thu Mar 23 19:04:00 2006 Return-Path: X-Original-To: stable@freebsd.org Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 78BE616A425; Thu, 23 Mar 2006 19:04:00 +0000 (UTC) (envelope-from mi+mx@aldan.algebra.com) Received: from aldan.algebra.com (aldan.algebra.com [216.254.65.224]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73B1D43D79; Thu, 23 Mar 2006 19:03:51 +0000 (GMT) (envelope-from mi+mx@aldan.algebra.com) Received: from corbulon.video-collage.com (static-151-204-231-237.bos.east.verizon.net [151.204.231.237]) by aldan.algebra.com (8.13.6/8.13.4) with ESMTP id k2NJ3n5M036489 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Mar 2006 14:03:50 -0500 (EST) (envelope-from mi+mx@aldan.algebra.com) Received: from mteterin.us.murex.com (195-11.customer.cloud9.net [168.100.195.11]) by corbulon.video-collage.com (8.13.6/8.13.6) with ESMTP id k2NJ3hFP007304 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 23 Mar 2006 14:03:44 -0500 (EST) (envelope-from mi+mx@aldan.algebra.com) Received: from mteterin.us.murex.com (mteterin@localhost [127.0.0.1]) by mteterin.us.murex.com (8.13.4/8.13.4) with ESMTP id k2NJ3cc7039703; Thu, 23 Mar 2006 14:03:38 -0500 (EST) (envelope-from mi+mx@aldan.algebra.com) Received: from localhost (localhost [[UNIX: localhost]]) by mteterin.us.murex.com (8.13.4/8.13.4/Submit) id k2NJ3a2L039702; Thu, 23 Mar 2006 14:03:36 -0500 (EST) (envelope-from mi+mx@aldan.algebra.com) X-Authentication-Warning: mteterin.us.murex.com: mteterin set sender to mi+mx@aldan.algebra.com using -f From: Mikhail Teterin Organization: Virtual Estates, Inc. To: Matthew Dillon Date: Thu, 23 Mar 2006 14:03:35 -0500 User-Agent: KMail/1.8.3 References: <200603211607.30372.mi+mx@aldan.algebra.com> <200603211717.34348.mi+mx@aldan.algebra.com> <200603212248.k2LMmTMj006791@apollo.backplane.com> In-Reply-To: <200603212248.k2LMmTMj006791@apollo.backplane.com> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-u" Content-Transfer-Encoding: 8bit Content-Disposition: inline Message-Id: <200603231403.36136.mi+mx@aldan.algebra.com> X-Virus-Scanned: ClamAV devel-20050525/1352/Thu Mar 23 01:44:26 2006 on corbulon.video-collage.com X-Virus-Status: Clean X-Scanned-By: MIMEDefang 2.43 Cc: alc@freebsd.org, stable@freebsd.org Subject: Reading via mmap stinks (Re: weird bugs with mmap-ing via NFS) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Mar 2006 19:04:00 -0000 в╕второк 21 березень 2006 17:48, Matthew Dillon Ви написали: >     Reading via mmap() is very well optimized. Actually, I can not agree here -- quite the opposite seems true. When running locally (no NFS involved) my compressor with the `-1' flag (fast, least effective compression), the program easily compresses faster, than it can read. The Opteron CPU is about 50% idle, *and so is the disk* producing only 15Mb/s. I guess, despite the noise I raised on this subject a year ago, reading via mmap continues to ignore the MADV_SEQUENTIONAL and has no other adaptability. Unlike read, which uses buffering, mmap-reading still does not pre-fault the file's pieces in efficiently :-( Although the program was written to compress files, that are _likely_ still in memory, when used with regular files, it exposes the lack of mmap optimization. This should be even more obvious, if you time searching for a string in a large file using grep vs. 'grep --mmap'. Yours, -mi http://aldan.algebra.com/~mi/mzip.c