Subject: Re: loaning for read() of regular files
To: Stephan Uphoff <ups@tree.com>
From: Chuck Silvers <chuq@chuq.com>
List: tech-kern
Date: 02/15/2005 18:49:45
On Tue, Feb 15, 2005 at 05:00:09PM -0500, Stephan Uphoff wrote:
> Hi Chuck,
> 
> looks great !
> 
> You may want to call pmap_remove for failed pmap_enter calls
> (or remove PMAP_CANFAIL?) to prevent stale page table entries.

good point, it's not really specified whether a failed pmap_enter(PMAP_CANFAIL)
that was replacing an existing mapping is required to remove the old mapping
or not.  we appear to have different behaviour on different platforms.

I would say that it should always remove the old mapping, since otherwise
the caller will have to take care of it explicitly anyway.  if everyone
agrees on this, I'll clarify this in the manpage and see about fixing
the implementations.


> Doesn't look like an issue on i386 unless you try to read() on a COW
> mapped device buffer. (If this is even possible ;-)

we don't support that, no.  they are silently converted to shared mappings.


> However it can theoretically be an issue on a SMP amd64 machines.
> (And maybe other architectures)
> 
> Mhhh .. for SMP it could be beneficial just to call pmap_remove for the
> whole range before the pmap_enter calls to cut down on the number of IPI
> calls. (At least for multi page reads on i386)

yea, that's better anyway.

thanks,
-Chuck