Re: Zone's in Linux
- From: Gil Hamilton <gil_hamilton@xxxxxxxxxxx>
- Date: Wed, 22 Aug 2007 16:40:05 +0200 (CEST)
Alexander Krizhanovsky <a.krizhanovsky@xxxxxxxxx> wrote in
news:1187785854.294148.246500@xxxxxxxxxxxxxxxxxxxxxxxxxxxx:
As far as I understood this comment x86 can't directly address memory
higher than 896Mb (I don't understand why here is wrote 900Mb):
So could you explain why we have only 896Mb of Normal Zone (that is
can't directly address whole 2Gb of physical memory)? Why these 2Gb
aren't fully arranged to NormalZone?
The issue is how much of the memory is visible in kernel *virtual memory*
at a given time. There is a total visibility of 4GB of virtual memory.
In the "normal" x86 linux kernel configuration, the virtual address space
is subdivided between user-space which gets 3GB (address 0 through
0xbfffffff) and 1GB for the kernel address space (0xc0000000 through
0xffffffff). That is, the kernel only has 1GB of virtual memory space
available for its use. Starting at 0xc0000000, the first X pages of
physical memory are mapped 1-to-1 into kernel virtual memory space. This
makes it convenient to access any low physical address: you just add
PAGE_OFFSET (0xc0000000) to it.
However, if you have 2GB, it's clearly not possible to map 2GB of
physical pages into a 1GB virtual memory window. Also, certain other
physical memory areas (such as PCI devices' memory-mapped I/O areas) need
to be accessible in kernel virtual memory. To accommodate these
requirements, the standard configuration only maps the first 896 physical
pages 1-to-1 with kernel virtual memory space.
That leaves the last 128 MB (from 0xf8000000 to 0xffffffff) of virtual
address space available for other physical pages to be mapped into. Some
of this area gets used by drivers for various devices (such as the
aforementioned PCI devices) to make their memory-mapped I/O spaces
accessible via the ioremap* APIs. Finally, any other memory that needs
to be accessed by the kernel, must use temporary mappings in the
"highmem" area as provided by kmap/kunmap (specifically
kmap_high/kunmap_high).
The mappings of physical memory to virtual memory in the user-space area
(the low 3GB) will vary according to which process is currently running,
which of its code and data pages are currently present, and so forth.
There used to be a config option (CONFIG_X86_4G) which allocated the full
4GB of vm to user-space and a full 4GB of vm to the kernel with separate
page tables for each. But AFAICT this may have been a RedHat-specific
feature that is no longer supported.
GH
.
- Follow-Ups:
- Re: Zone's in Linux
- From: Josef Moellers
- Re: Zone's in Linux
- From: Alexander Krizhanovsky
- Re: Zone's in Linux
- References:
- Zone's in Linux
- From: deepak
- Re: Zone's in Linux
- From: Alexander Krizhanovsky
- Re: Zone's in Linux
- From: deepak
- Re: Zone's in Linux
- From: Josef Moellers
- Re: Zone's in Linux
- From: Alexander Krizhanovsky
- Zone's in Linux
- Prev by Date: Re: Zone's in Linux
- Next by Date: Re: Zone's in Linux
- Previous by thread: Re: Zone's in Linux
- Next by thread: Re: Zone's in Linux
- Index(es):
Relevant Pages
|