Re: Page Replacement in 2.6.10

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

 



Hi Rik,
Did as you suggested... Learnt a lot of VM and rmap in the process :) Also found this on rmap:
http://www.finux.org/Reprints/Reprint-McCracken-OLS2004.pdf
I must say, it is well written and explains current rmap very well


But i'm still a bit confused...
Here's what i understand
first eviction....
1. shrink_list does the final writing out of the pages
2. If it as an anonymous page, it is added to the swap cache if not already there
3. for each page, it calls try_to_unmap()
4. try_to_unmap() calls try_to_unmap_anon() or try_to_unmap_file() based on type of page
5. try_to_unmap_anon() calls try_to_unmap_one() for each page
6.try_to_unmap_one() stores the swp_entry_t in the pte for anonymous pages
7. try_to_unmap_file() calls try_to_unmap_one() for each linear mapping and try_to_unmap_cluster() for each non linear one
8. in the former case, it does nothing to the pte because it is not an anonymous page, but in the latter, it stores the index within the mapped file in the pte


now, retrieval, ignoring COW details
1. On a page fault, the address id fetched from cr2
2. the vma corresponding to this address is found
3. if it an anonymous page
if the page was never used before, the no_page function of the vma_ops is called and it ends here.
if it was swapped out, the pte has the swp_entry_t and so we can fetch it from the swap space
4. if it is file backed
the struct file associated with this vma is got.
The address_space corresponding to the struct file is got.
if the page was not accessed before
the no_page function of vma_ops is called
if it is a linear vma
the struct file, the offset within the file is faulted address - start address of vma


      if it is a nonlinear vma
               the offset is in the pte

the populate function of the vma_ops is used to read the data in
is this right?


If so, then i'm confused...
ok, i can store the swp_entry_t as an id for the anonymous pages... but what about file backed ones? there doesn't seem to be any id as there needs to be none. Am i right here?
A lot of reading... but this one still evades me.
Thanks
Rahul




Rik van Riel wrote:

On Fri, 25 Mar 2005, Rahul Iyer wrote:



I agree... pid is not a good idea. So i thought of something else... the
swp_entry_t. What i forgot was that this is only for anonymous pages... disk
buffers and mmapped pages are not put on swap (right?). So, I'm looking at
something else now... primarily the page->private field.



You cannot use such an identifier, since the page will be GONE after it is swapped out, meaning the identifier (which
is your lookup key) will be gone too!




I guess, what i need is an identifier to tag every page that leaves the cache... whether anonymous, mmapped or disk buffer. Unfortunately I cannot find such an id. Actually, this is all that holds me up... the rest of what i need to do is in place - mentally that is. :) So, I could really use a tip ;)



OK, here's a tip: how do the page cache code and the page fault code decide which page to bring into memory ?




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