Hello,<br><br><div class="gmail_quote">On Tue, Feb 7, 2012 at 11:04 PM, Mulyadi Santosa <span dir="ltr">&lt;<a href="mailto:mulyadi.santosa@gmail.com">mulyadi.santosa@gmail.com</a>&gt;</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">
&gt; I&#39;m trying to understand the page replacement policy in the latest Linux<br>
&gt; kernel and reimplement a similar one in the user space.<br>
&gt; As far as I can understand from ULK and the code, there are two lists:<br>
&gt; active list and inactive list.<br>
&gt; Here I only consider the case of the *page cache*:<br>
&gt; When a page is added to the page cache (by add_to_page_cache_lru), it is<br>
&gt; also added to the inactive list and its reference bit is set (by<br>
&gt; mark_page_accessed).<br>
<br>
</div>I am not really sure about it. According to UTLK (I know, it is<br>
dated), page goes as &quot;inactive, not referenced&quot; first.<br></blockquote><div>Yes, when a page is added to a list by add_to_page_cache_lru(), it&#39;s inactive and not referenced, but the referenced bit will be set in the same read, so I put them together.</div>
<div><br></div><div>Please read do_generic_file_read(). If a page doesn&#39;t exist in the page cache, it will load the page and add it to the page cache. In the same iteration of the for loop, mark_page_accessed() is called to mark it referenced.</div>
<div><br></div><div>So UTLK isn&#39;t wrong. It&#39;s just a little misleading.</div><div><br></div><div>Thanks,</div><div>Da</div></div>