Re: Zones and high memory.

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

 



On Tue, 2007-04-17 at 19:00 +0530, Prasad Joshi wrote:
> Hi All,
> 
> I am confused with the ZONEs and HIGH memory. 
> 
> 
> Memory within ZONE_NORMAL is directly mapped by the kernel into the
> upper region of the linear address space. This is the physical memory
> directly accessible by the kernel and is related to the
> kernel/userspace split in the linear address space marked by
> PAGE_OFFSET. 
> 
> 
> Why ZONE_NORMAL is directly mapped into upper region of the linear
> address space? I think here PAGE_OFFSET (3GB) indicates the upper
> region of the linear address space ?

So that the kernel can _always_ access mem within ZONE_NORMAL. So, there
is a possibility that a page in ZONE_NORMAL is mapped in userspace to
(allocated to a process). So, then that page frame then has two mappings
one for the process and the other for the kernel itself.

> 
> 
> ZONE_HIGHMEM is the remaining available memory in the system and is
> not directly mapped by the kernel.
> 
> 
> Generally, 
> ZONE_DMA First 16MiB of memory
> ZONE_NORMAL 16MiB – 896MiB
> ZONE_HIGHMEM 896 MiB – End 
> 
> Now, the previous para says ZONE_NORMAL is at PAGE_OFFSET (3GB) but,
> this table indicates it at 16 MB ? 
> 
> Because the address space usable by the kernel (ZONE_NORMAL) is
> limited in size, the kernel has support for the concept of high
> memory. Two thresholds of high memory exist on 32-bit x86 systems, one
> at 4GiB and a second at 64GiB. The 4GiB limit is related to the amount
> of memory that may be addressed by a 32-bit physical address. To
> access memory between the range of 1GiB and 4GiB, the kernel

896 MB to 4GB actually...

>  temporarily maps pages from high memory into ZONE_NORMAL with kmap().

correct...
> 
> 
> What is the size of the ZONE_NORMAL? I think it is 1GB - 128 bytes. 

1GB - 128MB ;) ..

> 
> This is what I have concluded 
> 1. ZONE_NORMAL is from 16MB - 896MB.    ==> address space usable by
> the kernel

 Thats the physical memory, which is mapped from PAGE_OFFSET + 16MB.

> 2. High memory is from 1GB-4GB ==> to access this part of memory
> kernel has to temporarily map pages from high memory into ZONE_NORMAL.
> So, ZONE_HIGHMEM must be from 1GB-4GB and not from 896 MiB – End 

HIGHMEM is 896MB - 4GB (if u have 4GB ram).
Which is mapped runtime by the kernel if needed using kmap/kmap_atomic.
The virtual addresses for these temporary mappings for the kernel will
always be greater than PAGE_OFFSET + 896MB, i.e in the last 128Mb of the
virtual address space available.

> 3. I am not getting at all how kernel/userspace split is related to
> ZONE_NORMAL and ZONE_HIGHMEM?

It is related in a way, if you have 2G/2G user/kernelspace split, then
you can have more physical memory in ZONE_NORMAL, i.e it will be 2GB -
128MB if HIGHMEM enabled. This way the kernel is able to access more
physical memory directly (since ZONE_NORMAL is mapped directly), than
having to go through the overhead of kmap()/kmap_atomic().

> 
> I think I have put so many questions, please educate me. Thanks in
> advance.
> 

cheers,
sandeep



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