Subject: Re: map user memory in kernel
To: Chuck Silvers <chuq@chuq.com>
From: Jaromir Dolecek <jdolecek@NetBSD.org>
List: tech-kern
Date: 11/06/2005 21:49:31
On Sun, Nov 06, 2005 at 12:05:47PM -0800, Chuck Silvers wrote:
> > I thought this might be unsafe at first - the underlying pages
> > can be deallocated and memory of the previous structure could
> > be reused for different purpose, while we sleep blocked in futex
> > wait.
> > 
> > However, this would only happen if the page gets unmapped from
> > all the processes using the futex, _including_ the one currently
> > blocked in futex wait. In other words, this realistically cannot
> > ever happen. In no other scenario could the UVM structure memory
> > be reused for different object or purpose AFAICS.
> > 
> > Thus, it seems that is pretty safe to use, and we neither need
> > to actually map the page within the kernel nor maintain
> > any other context for the futex, which is neat.
> 
> the logical page can be paged out and replaced with a different
> physical page when it's paged backed in, so we cannot use the
> vm_page pointer for this purpose.

Could we use vm_map_entry ?
 
> the idea of using a separate sleep address for each valid futex offset
> within a page is fine, but I think that's as good as we can do.
> 
> -Chuck

Jaromir
-- 
Jaromir Dolecek <jdolecek@NetBSD.org>            http://www.NetBSD.cz/
-=- We can walk our road together if our goals are all the same;     -=-
-=- We can run alone and free if we pursue a different aim.          -=-