Subject: Re: Efficiency of nfsiod
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Gordon W. Ross <gwr@netbsd.org>
List: tech-kern
Date: 11/11/1998 23:22:43
Jonathan Stone writes:
 > [...]
 > yup, thats what i was tryng to say you told me before;).  On the sun
 > mmu you do a lazy-evaluation of the MMU context-switch: you wait til
 > you take a userspace fault before allocating pmegs.  But thats exactly
 > what you _cannot_ do on the arm32, because it has only 1 mmu context
 > and a virtually-indexed cache (I-cache, at least).
 > 
 > there, it'd win to have a hook saying
 >    `this process will be in kernel-only context until it says otherwise.'
 > exactly so that you _can_ do a lazy MMU context-switch.
 > 
 > hope thats clearer.

I'm not sure it's any more clear...  Anyway:

The "empty context" trick works whether a "context"
is a hardware or a software object.  If a context is
just a set of page tables in RAM, then the savings
comes from being able to share the page tables for
the "empty" context among several processes.  When
context switch happens, the new process will often
have the same MMU root pointer (because both point
to the empty context) and it can therefore cheat!
(Do not flush the cache or TLB!:)

All it takes is to switch from the "empty" context
to a "real" context when faulting-in user mappings.
Sun's MMU code for the x86 does this, for example.
So does the NetBSD/Sun3X (plain old 68030 MMU).

I think any kind of MMU should support this trick.
(No fixed kstack allowed, of course!:)

So, why can't the ARM or MIPS do this if desired?