lkml.org 
[lkml]   [2000]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: 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/

    \
     
     \ /
      Last update: 2005-03-22 12:38    [W:3.128 / U:0.620 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site