LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-02-2004, 11:50 PM   #1
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Rep: Reputation: 15
about memory?


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
 
Old 03-03-2004, 01:25 AM   #2
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
The numbers are offsets from zero, not sizes.

ZONE_DMA: pages below 16MB ( exclusive )
ZONE_NORMAL: pages above 16MB ( inclusive ) and below 896MB ( exclusive )
ZONE_HIGH: pages above 896MB ( inclusive )

``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?
 
Old 03-03-2004, 01:35 AM   #3
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
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
 
Old 03-03-2004, 02:07 AM   #4
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
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.
 
Old 03-03-2004, 03:26 AM   #5
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
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.
 
Old 03-03-2004, 04:54 AM   #6
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
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.

ZONE_NORMAL is pretty much the rest.

Is that enough for you to continue reading?
 
Old 03-03-2004, 05:25 AM   #7
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
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.
 
Old 03-03-2004, 06:31 AM   #8
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
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.
 
Old 03-03-2004, 06:39 AM   #9
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
Then where the ZONE_HiGH is mapped?
Does CPU address it directly?
 
Old 03-03-2004, 06:59 AM   #10
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
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.
 
Old 03-03-2004, 07:09 AM   #11
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
What is that pageframe descriptor?
 
Old 03-03-2004, 07:20 AM   #12
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
Quote:
Originally posted by eshwar_ind
What is that pageframe descriptor?
$(LINUXSRCDIR)/include/linux/mm.h: find `struct page'. Information regarding it starts at line 170 in my 2.4.25 sources.
 
Old 03-03-2004, 07:56 AM   #13
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
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.
 
Old 03-03-2004, 08:02 AM   #14
cjcuk
Member
 
Registered: Dec 2003
Distribution: Openwall, ~LFS
Posts: 128

Rep: Reputation: 15
The virtual member of the structure is actually, very nearly, the opposite of what you said there.
 
Old 03-03-2004, 08:04 AM   #15
eshwar_ind
Member
 
Registered: Feb 2004
Location: Bangalore
Distribution: Redhat
Posts: 144

Original Poster
Rep: Reputation: 15
That means null for High memory and some valid value for NORMAL and DMA ZONES
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
tool to detect number of memory slots, memory module type, speed, and size stefanwolf Linux - Hardware 8 04-22-2013 09:48 AM
Missing memory in USB stick, flash memory, removable hd etc bamboo_spider Linux - Newbie 3 06-14-2006 05:39 PM
Help Configuring the Memory Used by a Process in RedHat? (Cache Memory on CPU) geogecko Linux - General 3 02-23-2005 03:32 PM
Help!?! RH 8 Memory Mapping -High Memory-Virtural Memory issues.. Merlin53 Linux - Hardware 2 06-18-2003 04:48 PM
RH 8.0 Mapping Virtual Memory to get access to VMIC Reflective Memory PCI card. Merlin53 Linux - Hardware 0 05-05-2003 12:50 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration