lkml.org 
[lkml]   [1999]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectLocking memory (was Re: Questions regarding Linux swapping.)
Date
thomas.putnam@natinst.com 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.

--
............................................................................
Peter Desnoyers
162 Pleasant St. (617) 661-1979 pjd@fred.cambridge.ma.us
Cambridge, Mass. 02139 (978) 461-0402 (work) pjd@giga-net.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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