Re: Linux and physical memory

David Wragg (dpw@doc.ic.ac.uk)
17 Jan 1999 22:44:48 +0000


"christophe leroy" <christophe.leroy5@capway.com> writes:
> 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 ?

There are two issues here:

1) Why have a user/VM memory split at all; couldn't the kernel have a
completely separate address space?

As Alan says, this requires costly fiddling the page table on switches
between user and kernel mode.

2) Why always have physical memory mapped into the kernel's virtual
address space?

With all physical memory permanently mapped, the kernel doesn't ever
have to do work managing its address space when it allocates/frees
kernel data structures. It also allows 4MB pages to be used on x86.

(Actually Linux also has vmalloc, but see it is used much less than
kmalloc.)

But it can be done the other way: BSD doesn't map all of physical
memory, and if I recall correctly FreeBSD defaults to a 256MB kernel
virtual memory space. So the performance benefits from the Linux way
can't be enormous, but it's still nice.

Dave Wragg

-
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/