ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi!
Can any body explain me about kernel memory zones?
What is high memory, lowmemory, and DMA?
On what basis we decide which part of the memory belongs to which Zone?
Which among those doesnt belong virtual memory?
thanks in advance
please reply me
bye,
Eshwar
``The ZONE_DMA and ZONE_NORMAL zones include the "normal" pages of memory that be directly accessed by the kernel throught the linear mapping in the fourth gigabyte of the linear address space. [ ... ] the ZONE_HIGHMEM zone includes page of memory that cannot be directly accessed by the kernel through the linear mapping in the fourth gigabyte ...'' - `Understanding The Linux Kernel', 2nd Edition
What exactly do you want explaining about this, and what for?
I am studying the book Device drivers by Rubini. I havent understood about those memory zones.
Directly mapping means not going through page tables right?
What is this fourth gigabyte? you have only explained me about 896MBs
which is lessthan 1 GB.
Still i havent understood. Could you please give little more explanation?
Thanks .
bye
Eshwar
Sorry, I forgot to mention that my knowledge ( and the book I was quoting from ) is heavily towards IA32 -- so I am not sure if all of this is applicable elsewhere.
The 4th GB is 0xc0000000 and up. This is the part of the process address space that can only be accessed when in kernel mode.
To be honest with you, we could spend a very long time talking about this -- it is a very extensive topic. So, you either need to narrow your question down ( you can give a reference to something in the Rubini book if you want, I have a copy somewhere around here ) or you really need to find good reference on this ( as an example of how extensive memory management is, the book I referred to is 700 pages and approximately one third of it relates to memory management -- and then it is sometimes IA32-centric ). If you can afford it, I would recommend the book, as an entry point more than anything else.
Thank you very much Mr. Cjcuk !
If you have enough time, Just give me a general idea about those memory zones.
What are those memory zones, their purpose and how they vary from each other ( in Linux context and on any bus architecture) ?
I got strucked up while reading that "getting hold of memory" and "hardware management" chapters from that rubini book.
If i could get a general idea of those memory zones I can
continue studying that book, otherwise i cant.
I know what is DMA. But havent heard that there is a special memory zone for it.
Give me the details about that book(memory management) if possible i will buy it.
I might be distrubing you . Sorry.
Thanks once again.
Do not worry about disturbing me, if I did not have the time or inclination I would not reply.
The book is, ``Understanding the Linux Kernel'', 2nd Edition. It is written by D Bovet and M Cesati, and published by O'Reilly. The ISBN is 0-596-00213-0. It is not cheap, but is not really expensive. I think it is quite good.
Here is a brief explanation of how the zones differ...
Initially, the DMA in ZONE_DMA is not a general case of the acronym occuring. It is referring to the DMA performed in the usage of ISA. This memory, thus, has to refer to specific points in the physical locations.
The ZONE_HIGHMEM refers to memory that is not directly mapped ( the pages are not mapped into the 4th GB during kernel page table initialisation ), mainly due to limitations in the architectures ability to directly address that memory.
thanks Mr.cjcuk
Can you elobarate the term not directly mapped?
The addresses for NORMAL and DMA zones are mapped through pagetables right? or wrong? ( or pagetables also contain the same address as logical or virtual address)
just this is enough.
Actually i have a bad habit that if i dont understand a single sentence, I get the feeling of not understanding whole chapter.
To explain what I mean by not directly mapped. The mappings all occur in the 4th GB. This means you can only have 1GB of mappings, and 128MB disappears in overhead and other junk -- hence the 896MB mapped, and the lack of ability to map the rest. The directly mapped zones ( ZONE_DMA and ZONE_NORMAL ) have mappings here. The page tables are then coping with the translation of requests inside this 1GB mapping to the physical addresses.
Is that clear enough? Feel free to ask if you are still unsure. I do not want to write an essay on it, but I am not sure if I am being too brief.
Well, the kernel dealing with ZONE_HIGHMEM is where the problems start. This is really the reason that we deal in pages so much. At the point when you want to map anything inside ZONE_HIGHMEM, you can no longer be given a linear address and so have to be given a page frame descriptor. There are three methods used for then working with these page frames:
1) Permanent mappings: the mappings are added to a special page table
2) Temporary mappings: there a small set of spaces for high memory mappings available, use one
3) The mappings done for non-contiguous areas are capable of doing it. This is a more complex subject. If you need the in-depth knowledge, I can continue -- but, it gets fairly long from here on.
I understood a little.
there in that structure we have last field as
void * virtual.
if system is configured with high memory we have that element.
we have "virtual" value null for NORMAL AND DMA PAGES. for HIGH MEMORY we have a valid value right. This is what differentiates between pages of High and other memory Zones right?
I want to ask you so many doubts regarding that but i am afraid i asked somany.
First i will try to understand about the elements of that structure. There after i will ask you my doubts.
Thank you very much.
You are simply superb.
Thanks again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.