Messages in this thread |  | | Date | Mon, 4 Sep 2000 02:22:27 +0200 | From | Jamie Lokier <> | Subject | Re: zero-copy TCP |
| |
Alan Cox wrote: > > read/recv block while the NIC DMAs into user space main memory. > > Thats actually not always a win either. A DMA to user space flushes > those pages out of cache which isnt so ideal if the CPU wants > them. Some of the results are suprisingly counter-intuitive like this
Does it flush the CPU cache? I thought the CPU just snooped the bus and updated its cache with new data.
> > The NIC memory is never accessed directly. It's a cache of skbuff data > > payloads, and the only access is by DMA, in those places where the > > kernel stack normally does copy_to_user/copy_from_user. > > Yep. Unfortunately to make it work you need to do a bit more than that - you > have to pin pages in memory, flush caches on some cpus, lock those pages > against being truncated by another process (on the other cpu) and you have > to deal with queue reclamation when the nic gets short of buffers.
Ugh. User space DMA gets complicated quickly. The performance question is, perhaps, can you do this without a TLB flush (but with locking the struct page of course). Note that it doesn't matter if another thread, and this includes truncate/write in another thread, clobbers the page data. That's just the normal effect of two concurrent writers to the same memory.
-- Jamie - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |