Subject: Re: map user memory in kernel
To: Jaromir Dolecek <jdolecek@NetBSD.org>
From: Eric Haszlakiewicz <firstname.lastname@example.org>
Date: 11/06/2005 21:14:15
On Sun, Nov 06, 2005 at 08:41:02PM +0100, Jaromir Dolecek wrote:
> vm_anon is per-process thing, so we don't want to use that -
> we need to use the vm_page or vm_object.
> 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
> 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.
Why does it need to get unmapped? I though all that needs to
happen for the vm_page to have different contents is that the
original data gets paged out.
So when the data with the futex on it gets paged back in
the process that does the wakeup can have a different vm_page
than the one that went to sleep.