Hello, On Tue, Feb 7, 2012 at 11:04 PM, Mulyadi Santosa <[email protected]> > > > I'm trying to understand the page replacement policy in the latest Linux > > kernel and reimplement a similar one in the user space. > > As far as I can understand from ULK and the code, there are two lists: > > active list and inactive list. > > Here I only consider the case of the *page cache*: > > When a page is added to the page cache (by add_to_page_cache_lru), it is > > also added to the inactive list and its reference bit is set (by > > mark_page_accessed). > > I am not really sure about it. According to UTLK (I know, it is > dated), page goes as "inactive, not referenced" first. > Yes, when a page is added to a list by add_to_page_cache_lru(), it's inactive and not referenced, but the referenced bit will be set in the same read, so I put them together.
Please read do_generic_file_read(). If a page doesn'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. So UTLK isn't wrong. It's just a little misleading. Thanks, Da
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
