<br><br><div class="gmail_quote">On Tue, Sep 27, 2011 at 11:56 PM, Prateek Sharma <span dir="ltr"><<a href="mailto:prateek3.14@gmail.com">prateek3.14@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Tue, Sep 27, 2011 at 11:42 PM, Mulyadi Santosa<br>
<<a href="mailto:mulyadi.santosa@gmail.com">mulyadi.santosa@gmail.com</a>> wrote:<br>
> Hi :)<br>
><br>
> On Wed, Sep 28, 2011 at 00:14, Prateek Sharma <<a href="mailto:prateek3.14@gmail.com">prateek3.14@gmail.com</a>> wrote:<br>
>> Hello everyone,<br>
>> I am trying to understand the kernel page frame reclaiming<br>
>> mechanism, but one thing's bothering me:<br>
>> How does the kernel 'know' which anonymous pages to evict? In the LRU<br>
>> scheme, 'referenced/used' information for each page is required<br>
>> (AFAIK). But anonymous pages can be used by user processes 'at any<br>
>> time' without the kernel knowing about it.<br></div></blockquote><div>(AFAIK) Anonymous pages do not correspond to any file. It may be part of a program's data area or stack & is written to the swap area.<br>
When a process tries to access the anonymous pages it notifies the swapper to get back the swap area in mem. In case of a process which holds the swap token, swapping of anonymous pages is avoided.<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">
><br>
> Same question hog my mind too so far :)<br>
><br>
> The only satisfying self answer I could deduce is:<br>
> kernel can't track every access to pages when you do it like e.g mov<br>
> %ax,8(%esp). What kernel could track is when you access data via<br>
> wrappers. I forgot which ones, but remember some of them are updating<br>
> those "referenced" etc flags. Perhaps something like get_pages or<br>
> alike.<br>
><br>
> --<br>
> regards,<br>
><br>
> Mulyadi Santosa<br>
> Freelance Linux trainer and consultant<br>
><br>
<br>
</div>page_referenced_anon is called for anonymous pages by page_referenced.<br>
And as far as i could figure out, that uses mmu_notifiers. [calls<br>
pmdp_clear_flush_young_notify]<br>
<br>
Whether every anonymous page access is trapped, or only a few of them,<br>
i have not yet figured out.<br>
<br>
Linux-mm seems to be full of magic!<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br>