Understanding page faults code in mm/memory.c

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

 



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?

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

[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);    
    unlock_page(old_page);
    if (reuse) {
        // flush the old mapping out of the tlb.
        fluse_cache_page(vma, address);
        
        // creates a new mapping with entry in the page table        
        // [QN:] What is pte_mkyoung?
        establish_pte(vma, address, page_table, pte_mkyoung(...
        
        spin_unlock(&mm->page_table_lock);

        // [QN:] why didn't the mm->rss increased since it is
        // a minor fault? hmm, i am not sure what minor
        // fault is though.
        return 1; /* minor fault */
    }
}    

Hear from you guys. Thank you so much.

Cheers,
Eugene
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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