Re: About LRU..

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

 



Please comment on my comments, and criticize the criticisms:

On Tue, Feb 26, 2008 at 7:14 PM, shyam burkule <shyam.linux@xxxxxxxxx> wrote:
> Hi ,
>    I am studing current page reaplcement policy that is LRU (actually LRU
> like policy) .
>
>             In that ,  whenever there is first access to page , insert that
> page into inactive list ( PG_lru =1 , PG_referenced =0 ) . For second

Do u mean by this the 2 step transition behavior of mark_page_accessed():

/*
 * Mark a page as having seen activity.
 *
 * inactive,unreferenced        ->      inactive,referenced
 * inactive,referenced          ->      active,unreferenced
 * active,unreferenced          ->      active,referenced
 */
void mark_page_accessed(struct page *page)
{
        if (!PageActive(page) && PageReferenced(page) && PageLRU(page)) {
                activate_page(page);
                ClearPageReferenced(page);
        } else if (!PageReferenced(page)) {
                SetPageReferenced(page);
        }
}

?   As a start, who are the caller of mark_page_accessed()?   In my
analysis, mark_page_accessed() is not called at page fault time, and
therefore, the page has already existed, and therefore, this is just a
way to make it transition to another state.

> reference , keep the page in inactive list but mark it accessed . (PG_lru =1
> and PG_referenced =0 ) . For third reference , move the page to active list
> (PG_lru =1 , PG_active =1 and PG_referenced =0 ) .
>
>           OK.... but whenever there is page fault , control comes to
> handle_mm_fault . It determine causes of page fault ans accordingly handle
> it . >
>                                     handle_mm_fault
> do_anonymous_page            do_wp_page                    do_swap_page
>
> In any case (mentioned above ), if these function allocates new page frame
> then that page frame is directly get added into active list (by calling
> lru_cache_add_active ) .
>
>               I am here not unserstanding , why this algorithm directly add
> new page to active list , eventhough that page has first access ?
>
>

But the do_XXXX_page() functions u see above, are originating from
page fault, and therefore, it is the first time the page is created
for it, and the status is therefore active, since it is created upon
demand.

Linux worked by demand-paging,
http://www.science.unitn.it/~fiorella/guidelinux/tlk/node26.html.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at 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