On Sat, 26 Jul 2003, Eugene Teo wrote: > Hi there, > > With reference to 2.4.20, I have a few questions: > > [1] I was looking at mm/memory.c. I noticed that there is a > difference between minor, and major faults. My guess is that > when a major fault occurs, the mm performs a page-in from the > swap to the memory, whilst a minor fault doesn't? No? not necessarily from swap area. it can read a page from the disk when faults on a memory mapped file's address. So if u have to wait for a disk operation when you fault then it is a major fault else if the fault is just because of protection reasons or something else which does not require to wait for a disk operation then it is a minor fault. > > [2] I understand that for the handle_pte_fault routine, the > if structure basically handles page-in. I am trying to figure > out where I can find the code for page-out which I understand > it can be involved the swap, etc. Can someone give me some > pointers as to where I can look for: > > - what causes page-outs, > - where in the kernel can i look for them? > look at try_to_free_pages in vmscan.. it will tell when a page is swapped out. the whole of vmscan.c tells you about swapping out. > [3] in mm/memory.c, in do_wp_page, I am not sure what the > portion of code is about: > > // If old_page bit is not set, set it, and test. > if (!TryLockPage(old_page) { > > // [QN:] I don't understand what can_share_swap_page() do > // I tried tracing, but i still don't quite get it. > int reuse = can_share_swap_page(old_page); can_share_swap_page checks whether the page is in the swap cache and is it an exclusive swap page ie no other process is sharing it. if it is so then it establishes the pte entry. HTH, Raghu -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/