Subject: Re: Request for comments: sharing memory between user/kernel space
To: None <tech-kern@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-kern
Date: 03/22/2007 02:47:55
On Wed, Mar 21, 2007 at 08:02:36AM -0800, Bill Stouder-Studenmund wrote:
> On Wed, Mar 21, 2007 at 03:57:51PM +0100, Zeljko Vrba wrote:
> > I'm aware these problems. But your 'usually' does not apply to my case: I'm
> > willing to give up on the stream abstraction on the application level. The
> > kernel currently already does everything on the packet-level, and copies data
> > to a contiguous user buffer. Why not just return to the user-level an array
> > of iovecs with proper <pointer,length> pairs referring to the TCP data
> > payload. It's the work that the kernel does anyway, I'd 'just' (quotes since
> > I have no clue about implementation complexity) like to replace the data
> > copying part (which preserves the stream abstraction) with returning the iovec
> > array where pointers point into application-accessible memory (which breaks
> > the stream abstraction, and I don't care about that :))
>
> Well, one thing you could do is add an ioctl on a socket that passes in
> memory buffers. Then change the socket code so that, on your special
> sockets, data are copied to these pre-allocated buffers rather than a
> socket buffer. That will get rid of one copy and would be rather clean.
I don't think I understand. This sounds to me like an asynchronous
version of readv(2). I have missed how you save a copy.
Dave
--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933