[linux-elitists] ME roadshow
Wed Sep 6 18:52:31 PDT 2000
On Wed, Sep 06, 2000 at 01:27:51PM -0700, Ben wrote:
> > Since 1991, one of the biggest trends in CPU performance has been the
> > increasing importance of the cache and TLB. This means that the best
> > way to get really high-performance behavior for your kernel code is to
> > map it into each process's address space--what Linux does with modules.
> > It sounds like QNX does this for core kernel components, but if you follow
> > this argument to its logical conclusion, you'll say "hmm, anything we
> > implement as an out-of-kernel server is going to thrash the cache and TLB,
> > and will suck performance-wise, so let's just move it all into loadable
> > modules." Of course, you still want stuff like Apache outside the kernel
> > for reasons of security and robustness, but anything that needs to take
> > advantage of highly asynchronous hardware behavior should be in there.
> So does this mean that the days when the kernel lives in one address
> space and each user space application had its own memory space are
> gone. I remember in my kernels class they talked about the two kinds
> of VM systems. One was when the kernel was mapped into the same
> address space as the user process and the other was when the kernel
> had an independant memory space all its own. I know Linux at least on
> intel is using the first method.
You're right, Linux uses the first method on all architectures.
The cost of TLB flushes (and cache flushes, on architectures like ARM
with virtually addressed caches) is one of the main reasons why Linux
will continue to keep itself mapped into each process's memory space.
It used to be that all physical RAM pages were mapped all the time,
but the addition of >2GB memory handling on IA32 has added support
for dynamic mapping of physical memory into the kernel address space.
That's a special case, though; usually it's all mapped all the time.
It basically looks like this:
Kernel mapping |
for all RAM |
VM for one user program | |
______________________________ ___|____ _|___
/ \ / \ / \
0 ^ 4GB
(usually 0xC0000000 = 3GB)
[not to scale]
On a task switch, the VM beneath PAGE_OFFSET changes to that of another
process, but the VM above PAGE_OFFSET stays the same.
More information about the linux-elitists