Subject: Re: VM change for R4000
To: Toru Nishimura <locore64@alkyltechnology.com>
From: Jason Thorpe <thorpej@shagadelic.org>
List: port-mips
Date: 03/12/2005 18:41:47
On Mar 12, 2005, at 5:58 PM, Toru Nishimura wrote:

> It's been troublesome for me to handle non-current pmap.  What's the 
> exact
> condition AVPT is required to use?  My impression is in the most of 
> case
> non-current pmap ops are done by kernel_pmap() to reclaim dying 
> process.
> (change in cpu_wait() made a headache for my case...) VPT and AVPT have
> 4MB in size and naturally aligned and they always are compatible in VA
> indexing.

Consider using pmap_extract(pm, ...), where pm is not the kernel pmap 
and not the current user pmap.  This does happen from time to time.

> No, no.  Kernel MUST avoid that case in every effort.  NetBSD/mips 
> kernel
> allows dynld to map libc (and other dynamic libaries) in incompatible 
> VA.
> This is LATHAL.  It's the reason why any user process will die.  mmap()
> system call has to return compatible addresses.  PLS refer the 
> definition.
> Kernel/VM is in charge to do the right thing.

...and MAP_FIXED also has to continue to work.

So, what to do you propose to do if the kernel can't provide an optimal 
VA base for a given mapping?

Doing what you suggest also requires filing free pages into separate 
buckets, presumably based on the cache index of their KSEG address.  
This would allow you to very quickly allocate a page for a specific 
virtual cache index.

I think if the kernel works very hard to behave optimally, then that 
gives you basically all of the benefit.  But the system MUST continue 
to run even if it can't satisfy a request for physical memory in the 
optimal fashion.

-- thorpej