[lkml]   [1999]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Locking memory
    Peter Desnoyers wrote:
    > wrote:
    > >
    > > Actually, I've been looking for a way to lock down chunks of user memory from
    > > within the driver I'm writing without the permission check in mlock. Is there a
    > > clean, exported interface to this?
    > I have to do the same thing, and I'm doing it by incrementing the count
    > in the page table with mem_map_inc_count(). Mlock takes the opposite
    > approach, modifying the virtual memory areas. I'm not sure which is the
    > right approach - I'm suspicious of the approach I've used as I end up
    > having to do a read/write on each page to properly handle copy-on-write,
    > but I don't know enough about VMAs to feel confident taking the mlock
    > approach.
    > I assume that the reason you're looking to do this is similar to mine -
    > allowing the user to register a buffer which the hardware DMAs into, and
    > which can then be read directly from user space. This is the opposite of
    > the approach taken by the sound drivers I've skimmed through, which seem
    > to allocate pages in the kernel, set the reserved bit in the page table,
    > and then let the user code mmap them. That's probably partly because
    > the sound cards need physically contiguous pages for DMA, while my device
    > (and yours?) can do scatter/gather.

    Stephen Tweedie's raw_io work is in 2.3.12 and does
    a large amount of work in this area. Have a look at
    include/linux/iobuf.h and the related files.

    Doug Gilbert

    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 13:53    [W:0.018 / U:74.764 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site