Subject: Re: Measuring memory to memory copy operations (+ interrupts, DMA)
To: David Laight <david@l8s.co.uk>
From: Kamal R Prasad <kamalrpr@in.ibm.com>
List: tech-kern
Date: 08/25/2003 13:35:13
On Fri, Aug 22, 2003 at 02:27:08PM -0400, der Mouse wrote:
> >> how does one pin dynamically allocated memory in libc (so that it
> >> could be used by an interrupt handler)?
> > You can't, and shouldn't be trying to.
> 
> Can't?  Isn't that what mlock() does?

>That will lock the memory backing the user processes virtual address,
>doesn't mean you can access it from a random routine that isn't
>running in the context of the relevant process.

>I even think that mlock() will just guarantee than copy{in,out}()
>won't block - you still have to use the functions.

It looks like what you are saying is true. AIX has a function inside the 
kernel which pins user memory ie we are not supposed to use mlock() for 
this purpose.
I tried locating equivalent code on netbsd.org but couldn't. The pcb 
structure should have a long which points to a buffer allocated in user 
space and passed to it via the profil() system call which pins the buffer 
before it can be accessed inside an interrupt handler. someone can shed 
more light on this.

thanks
-kamal






-- 
David Laight: david@l8s.co.uk