Re: Linux and physical memory

Max (max@Linuz.sns.it)
Sun, 17 Jan 1999 14:44:37 +0100 (MET)


On Sun, 17 Jan 1999, Alexander Viro wrote:

>On Sun, 17 Jan 1999, christophe leroy wrote:
>
>> I'm triying to understand the way memory is managed under Linux.
>> I cannot understand why we need to "reserve" 0xC0000000-0xFFFFFFFF
>> of virtual memory for physical memory.
>>
>> Why do we need to map entire physical memory to part of virtual
>> memory ?
>
> Because the kernel is not a separate process on UNIX. It's a
>common part of all processes. When the control is passed to the kernel
>(either by system call or by hardware interrupt) no context switch occurs.
>Processor simply switches into the privileged mode and jumps into the
>kernel code (inaccessible from user mode). This could be done different
>for system calls (microkernels), but for interrupts flipping MMU state (VM
>map) would lead to delays unacceptable for many sorts of hardware. Kernel
>code needs to access *all* physical memory. Linux simply maps it starting
>from 0xc000000 (on x86). It's not the only way, see 4.4BSD pmap layer for
>example of alternative design. But there is no way in Hell to make all
>address space available for process. At the very least, you should have
>all kernel code mapped into it (and completely closed for usermode).
>Ditto for for large part of kernel data. It's not a Linux-specific
>question, BTW - it's how things work in any UNIX kernel.

Maybe I am stupid, but while I understand this is correct (i.e. reserve a part
of processes address space to point to kernel code/data), I don't
understand why the kernel needs to always have all physical memory mapped
in its address space.

Massimiliano Ghilardi

----------------------------------------------------------------
| I have yet to meet a person who had a bad experience of Linux. |
| Most have never had an experience. |
----------------------------------------------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/