From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 6 21:23:10 2004 Return-Path: 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 089C716A4CF for ; Tue, 6 Jul 2004 21:23:10 +0000 (GMT) Received: from odin.ac.hmc.edu (Odin.AC.HMC.Edu [134.173.32.75]) by mx1.FreeBSD.org (Postfix) with ESMTP id E124F43D46 for ; Tue, 6 Jul 2004 21:23:09 +0000 (GMT) (envelope-from brdavis@odin.ac.hmc.edu) Received: from odin.ac.hmc.edu (IDENT:brdavis@localhost.localdomain [127.0.0.1]) by odin.ac.hmc.edu (8.12.10/8.12.10) with ESMTP id i66LMtOF024750; Tue, 6 Jul 2004 14:22:55 -0700 Received: (from brdavis@localhost) by odin.ac.hmc.edu (8.12.10/8.12.3/Submit) id i66LMtXX024749; Tue, 6 Jul 2004 14:22:55 -0700 Date: Tue, 6 Jul 2004 14:22:54 -0700 From: Brooks Davis To: thefly Message-ID: <20040706212254.GA22673@Odin.AC.HMC.Edu> References: <20040706133640.GB5922@tyler> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="h31gzZEtNLTqOjlF" Content-Disposition: inline In-Reply-To: <20040706133640.GB5922@tyler> User-Agent: Mutt/1.5.4i cc: freebsd-hackers@freebsd.org Subject: Re: ZEROCOPY between kernel and userland X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jul 2004 21:23:10 -0000 --h31gzZEtNLTqOjlF Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable [Please don't top-post, it tends to lose context.] On Tue, Jul 06, 2004 at 03:36:40PM +0200, thefly wrote: > could you point me pls to some code of that? To me read-only access is > ok, userspace doesn't need to write anything on it, kernelspace does. > But what about locking issues between userspace read access and > kernelspace write access? First, be aware that mmap is not necessicairly faster then copyout on modern CPUs. The cycles required to copy a few K of bytes aren't worth much of anything on a modern CPU compared to a page-fault. Second, if you still want to do things this way, take a look at the geom statistics mechanism. IIRC, it works by using a generation number at the top and bottom of the stats structure. The user copies the entire struct and then verified that the copies of the generation number at the top and bottom of the struct are the same. If so, it uses the copy it got. If not, it tries again. -- Brooks --=20 Any statement of the form "X is the one, true Y" is FALSE. PGP fingerprint 655D 519C 26A7 82E7 2529 9BF0 5D8E 8BE9 F238 1AD4 --h31gzZEtNLTqOjlF Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQFA6xguXY6L6fI4GtQRAn36AJ9Lc1Fux87d3YcLwDLA5rKTHMudDACgsD/s 8+QhThyeYv8WHd+iS0j/Ncg= =Ipq3 -----END PGP SIGNATURE----- --h31gzZEtNLTqOjlF--