Re: A quick question on VM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11-01-08 06:27, sahlot arvind wrote:

I just started learning Linux Virtual Memory Management Subsystem.
I see the memory is divided into three zones. Comments in file mm/mmzone.h
/*
 * ZONE_DMA       < 16 MB       ISA DMA capable memory
 * ZONE_NORMAL  16-896 MB       direct mapped by the kernel
 * ZONE_HIGHMEM  > 896 MB       only page cache and user processes
 */
Here second comment (ZONE_NORMAL) says that it is directly mapped by kernel. Could anybody please tell me what does direct mean here? Does
this mean Physical address = Virtual Address???

No, although it does mean VA = PAGE_OFFSET + PA (also true for ZONE_DMA by the way) the "direct" isn't in fact the important bit -- _permanently_ mapped is.

The 4G 32-bit address-space available to each process is divided in a region for user-space and one for kernel-space -- 0 to PAGE_OFFSET-1 for user-space and PAGE_OFFSET to 4G for kernel-space.

By default, PAGE_OFFSET is 3G meaning kernel-space occupies the last 1G of address-space. In this space, first "all" of physical memory is mapped and the remaining bit is used for things like vmalloc() and ioremap(). In fact, 128M is always reserved for that latter use, meaning that "all" in the above can be at most 1G - 128M = 896M.

If you have more physical memory than that (common these days for newish machines) the remaining bit is treated as HIGHMEM which is mapped into kernel-space when eeded and unmapped again when done with it.

The first 896M is still simply permanently mapped at PAGE_OFFSET and that's the important characteristic of ZONE_NORMAL.

Please note that if you start learning about the kernel _now_ you should probably simply forget about 32-bit. Highmem is no more than a hack to get around 32-bit machines having "just" 4G address-spaces and on 64-bit it's completely non-existent.

Rene.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux