LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-11-2004, 10:01 PM   #1
ministre
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Rep: Reputation: 15
Linux Swapper


Hello,

I have a question about the functioning of the linux swapper. I am looking at kernel 2.4.26. I am also refering to the o'reilly book "undestanding the linux kernel".

From what I undestand, when the system runs low on physical memory, linux goes through the page table of user processes and swaps out some pages to the swap cache which are then periodically flushed to disk (swap partition)

My question is the following:
The pages that store the page tables themselves (i.e the pages that store the pgd, pmd and pte), are those pages ever swapped out ? Or is it the case that only pages that contain data, code, stack, head etc... that are swapped out.

I am not sure if this is the right forum to discuss specific kernel questions. If someone can direct me to a good forum that deals with low level kernel details please let me know.

Thanks
 
Old 09-11-2004, 10:42 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
the fist layer of pages that store the pointers to the second layer pages are never swapped out
FWIW the 2.6 kernels contain huge improvements to the vm system

Last edited by foo_bar_foo; 09-11-2004 at 10:43 PM.
 
Old 09-12-2004, 10:20 AM   #3
ministre
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
the fist layer of pages that store the pointers to the second layer pages are never swapped out
Hello,

From what I understand, the top level swapping function is swap_out.
For each user process swap_out invokes swap_out_mm on the memory descriptor mm_struct of the process. swap_out_mm then calls swap_out_vma on each memory region of the process. From there some pages of some memory regions are swapped out. So from that I would have thought that only pages that are part of a process's memory region are swapped out. Since pages that store the page table themselves (1st or 2nd level) are not part of any memory region then I would think that those pages are never swapped out. Could you please give me some more info on where the 2nd level page tables are swapped out. I am looking at kernel 2.4

Thanks
 
Old 09-12-2004, 03:26 PM   #4
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 53
i think we are kind of talking at cross currents using the same term to describe different things
first of all i might be wrong about some of this
linux uses a three level pagetable and the differences between levels can get blurry
PTE lowest level page table entry
PMD page middle directory(most processors just fold this back to PGD)
PGD page global directory
each process has a page global directory which is a physical page frame containing an array pgd_t
each active entry in pgd points to another page frame pmd that contains an array pmd_t
each active entry in pmd_t points to a page frame pte with an array pte_t that is first level
and actually points to page frames that contain data

all i was saying is PTE (what i was calling first layer) node_mem_map the first page in the struct page array
representing each physical page frame in each node is placed in the global mem_map array in zone NORMAL which to my knowledge is the only thing accept PG_reserved in zone HIGHMEM that is actually help permanently in memory. but as i said i could be wrong about that.

All nodes in the system are maintained on a list called pgdat_list
each node is divided into blocks called zones
Each zone is described by a struct zone_t that keep track of it's usage locks and stuff
pages are mapped to zones ZONE_DMA ZONE_NORMAL ZONE_HIGHMEM
each zone has three watermarks for mem preasure low med high
when these are reached the pageout daemon get woken up and essentially uses the watermark to determine how hard to work free pages
in highmem symbol PG_reserved stands for pages set at boot to never be swapped -- this is used to keep track of holes.
also in highmem are a bunch of flags that keep track of memory

that's about all i know about it

Last edited by foo_bar_foo; 09-12-2004 at 03:29 PM.
 
Old 09-12-2004, 07:23 PM   #5
ministre
LQ Newbie
 
Registered: Jul 2003
Posts: 28

Original Poster
Rep: Reputation: 15
Thanks a lot foo_bar_foo for all the information.

Would you know by any chance some other linux forums that deal specially with kernel questions like mine.

Thanks
 
  


Reply



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
link dies intermittently-seemingly at random- between win<->linux not linux<->linux?? takahaya Linux - Networking 10 03-09-2007 10:37 PM
triple boot linux/linux/linux No Windows involved toastermaker Linux - Newbie 12 03-02-2006 10:40 PM
kernel panic+swapper not syncing Jyo Linux - Software 3 09-06-2004 10:16 AM
Redhat (rhel v2.1) bootup problem with linux (linux vs linux-up) namgor Linux - Software 2 06-24-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:07 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