Need of different memory zones

Arun KS getarunks at gmail.com
Fri Mar 15 03:01:23 EDT 2013


Hi Niroj,

On Wed, Mar 13, 2013 at 3:16 PM, Niroj Pokhrel <nirojpokhrel at gmail.com> wrote:
> Hi All,
>
> I have been studying Memory Management in linux. But I am confused with the
> division of different ZONE. The use of ZONE_DMA and ZONE_NORMAL is fine. But
> I am confused with ZONE_HIGHMEM, if the system is 32 bit then why can't it
> map 4GB memory (2^32). I had thought that ZONE_NORMAL was for the kernel
> usage so directly mapped and ZONE_HIGHMEM for the user process and is not
> directly mapped to facilitate virtual addressing. But I know I am not
> getting something right. While going through Ch - 15 of Rubini's Linux
> Device Driver (Memory Management and DMA) I came across following line
>
> "a 64-bit architecture such as Intel’s x86-64 can fully map and handle
> 64-bits of memory.Thus, x86-64 has no ZONE_HIGHMEM and all physical memory
> is contained within ZONE_DMA and ZONE_NORMAL."  So, if it can be directly
> mapped why not in 32 bit architecture.
>
> I am really confused. Please Help. Thanking you in Advance

On a 1:3 VM split, kernel has 1GB of virtual space.
This 1GB kenel VM is split accross I/O mapped registers, Interrupt
vector table, VMALLOC area
and your system memory(ie RAM).

For example let's say,
I/O mapped register + VMALLOC area + vector table = 200MB.
So virtual space left for System memory = 1024MB - 200MB = 824MB.
Now consider you have 1GB of System memory(RAM). How will you use it?

Two ways
1) You can change VM split(user space:kernel space) to 2:2, or
2) Use High Mem.

If using 2:2 VM split, then your kernel space is 2GB and you have
plenty of space to map system memory.

If High mem, you will have a temporary mapping to High mem area. This
mapping is usually used from vmalloc area.
High mem, in our case is 200MB( 1024MB of total ram - 824 MB which is
already mapped to kernel virtual space)
Permanent mapping also is available from high mem. But this VM space
will be limited in size(eg 2MB).  This is know as pkmappings.

For more information have a look at page 253 of Linux kernel
development 3rd edition- Robert Love.

All this complexity will go into vents when 64 bit architecture comes because,
2^64 = 16ExtraByte(EB)
You have 16EB of virtual space compared to 4GB of virtual space for 32
bit architecture.

HTH

Arun
>
>
> Yours,
> Niroj Pokhrel
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



More information about the Kernelnewbies mailing list