From owner-freebsd-hackers Sun Mar 8 07:42:23 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA07399 for freebsd-hackers-outgoing; Sun, 8 Mar 1998 07:42:23 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from scanner.worldgate.com (scanner.worldgate.com [198.161.84.3]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA07377 for ; Sun, 8 Mar 1998 07:42:18 -0800 (PST) (envelope-from marcs@znep.com) Received: from znep.com (uucp@localhost) by scanner.worldgate.com (8.8.7/8.8.7) with UUCP id IAA20734; Sun, 8 Mar 1998 08:42:15 -0700 (MST) Received: from localhost (marcs@localhost) by alive.znep.com (8.7.5/8.7.3) with SMTP id IAA05401; Sun, 8 Mar 1998 08:38:39 -0700 (MST) Date: Sun, 8 Mar 1998 08:38:38 -0700 (MST) From: Marc Slemko To: Julian Elischer cc: hackers@FreeBSD.ORG Subject: Re: kernel wishlist for web server performance In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Sat, 7 Mar 1998, Julian Elischer wrote: > > > > Let me put it this way: how else do you propose to do copy avoidance to > > avoid an extra copy going into the mbufs? The data must go from the > > buffer cache to the network without any copy other than to the network > > card itself. Why is your other method of doing this any less of a hack? > [...] > I would like to add here that in FreeBSD's unified VM/Buffer cache, > a mmapped file IS the buffer cache > so that a send() from an mmapped file IS copying direct fromt he buffer > cache. Ther eis ONE copy.. that from the buffer cache, into the mbuf. But the point is that you still have to copy it into the mbuf, you still have to use the memory for the mbuf, etc. This uses more CPU and memory bandwidth, increases memory use, and means you may have to chop things up smaller to avoid using too much memory for mbufs. To avoid that copy, you have two choices. First, you can play around with copy avoidance for mmap() then send() or write(). This can be done with COW, or page flipping. See the HP paper for more details on this approach. Doing it this way is really an ugly hack and there are numerous difficulties that crop up, making it less than desirable. Or, you can use sendfile() and code it so it doesn't have to copy into mbufs. This is easier because of where the data is coming from. Now, doing this right is dependent on having the right networking hardware and networking drivers. It is, however, a very worthwhile feature from a performance standpoint and more and more other OSes are adding it. > > (assuming that the data got into the memory via DMA in the first place..) > you may need to have a subprocess go through and tuch all the pages to > get them into ram first.. > > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message