Re: Understanding page faults code in mm/memory.c

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

 



<quote sender="Raghu R. Arur">
> On Sat, 26 Jul 2003, Eugene Teo wrote:
> > 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.

I don't really understand the part about memory-mapped files. When will
it be used?

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

oh, the code that does the page eviction. i also noticed that there
is some code in the block.c that does page in and out. i point it to
you when i get to copy and paste in X.

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

1) can i say that like shared memory, swap pages can be swapped? or is
it because it is shared memory among processes, and that pages happened
to be in the swap cache, so checking if those pages are exclusive swap
pages will fail because it is shared memory, and processes are sharing
it?

2) establishes the pte entry - i noticed that it flushes the tlb with
the previous old pte entry. set_pte() simples assigns the new entry to
the page table?

3) any idea why this is done? check it is exclusive swap page, and if it
is in the swap cache, then establish the pte entry, then return to the
caller. Any idea why mm->rss is not increased? oh, is it because there
is no new pages page-in, and out, and it is merely a replacement of the
old page with a new page?

Thanks Raghu.

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