Re: Page Replacement in 2.6.10

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

 



Hi,
As my first stab at coding CART, I was looking to write some code that could 'walk' through all the pages in mem_map and look whether they were accessed or not. But these are physical pages and the accessed bit is set in the page table entry for the virtual address that maps to this page. Unfortunately, there is no pointer from struct page to the page table entry (struct pte_t) using the page, probably because there may be more than one. I then looked at rmap.h and rmap.c in 2.6.11. In those files i saw page_referenced(...). From what i gather, this function tests and clears the referenced flag for the given pages. Am I right?


Another question... what is ignore_token? As I saw from the source,

if (mm != current <http://lxr.linux.no/ident?i=current>->mm && !ignore_token && has_swap_token <http://lxr.linux.no/ident?i=has_swap_token>(mm))
<http://lxr.linux.no/source/mm/rmap.c#L292>                 referenced++;

I gather that... if the *mm (address space) of the vm_area pointed to by the *mapping of the page is not that of the current process and ignore_token is 0 and mm == &init_mm (i.e. it's pgd = swapper_pgdir) then add one to referenced. I couldn't get the logic behind this bit.

Thanks in advance
rahul
P.S: Are all pages that are not backed by files (mmap'd) called anonymous pages?


Rik van Riel wrote:

On Wed, 2 Mar 2005, Rahul Iyer wrote:



I think i worded it wrong... There is only 1 page cache. It's structure and replacement policy could be chosen at boot time. For example, you could select kernel boot time argument, say page_cache, as page_cache=LRU and the page cache would follow an LRU based replacement scheme. Or maybe page_cache=CART and you'd have CART instead.



That would work, but you would instead need to replace try_to_free_pages and friends, not the functions you gave.




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