Re: About LRU..

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

 



On Thu, Feb 28, 2008 at 4:16 PM, shyam Burkule <shyam.burkule@xxxxxxxxx> wrote:
>
> On 2/26/08, Peter Teoh <htmldeveloper@xxxxxxxxx> wrote:
> > 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.
>
> I think , this is not sufficient reason to add those pages (faulty pages) to
> active list. The issu is not yet cleared to me. Why page fault pages are
> directly added to active list?

Yes u may be right, because it does not matter at this stage - whether
to put it on the inactive or active list.   If there exist 3 level,
with something called intermediate list, I will put it there.
Because this is the FIRST access to that page, and then it triggered
page fault.   After putting on the active/inactive list, the content
of the page will be filled with data (in write scenario) and vice
versa for read scenario.

And after this first access, the memory may not be accessed again at
all.   So that is why I think it may not be impt to put in
active/inactive list.   Moreover, so long as there is sufficient
memory, swapout will not go into action - which is the sole user of
the active/inactive list.

Not sure if there is any bugs in my analysis?

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