Subject: Re: map user memory in kernel
To: Emmanuel Dreyfus <manu@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 11/05/2005 15:42:43
On Sat, Nov 05, 2005 at 03:32:00PM +0000, Emmanuel Dreyfus wrote:
> On Sat, Nov 05, 2005 at 12:22:45PM +0100, Wolfgang Solfrank wrote:
> > So no need to actually map the page into memory.  Just make a more or
> > less unique address out of the address given (like e.g. use the physical
> > address on machines where physical and virtual address sizes match) and be
> > done with it.
> 
> But what if the page where the address is gets paged out? I can't 
> rely on a physical address in that situation.

There must be some kernel 'page' structure that refers to the containing
page - since the page will remain shared ever in paged out
(for mmap()ed files wher you have the kernel vnode).

Munge that address and the offset together for the sleep.

Alternatively, remember that a valid wakeup can (usally) wake up all sleepers,
so you could just wake up all waiters, or just use the page offset.
That should give you a working implementation - if not stupendously efficient.

	David

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