Re: [RFC 6/8] In order putback lru core

From: KOSAKI Motohiro
Date: Sun May 08 2011 - 23:21:27 EST


> On Sun, May 1, 2011 at 10:47 PM, KOSAKI Motohiro
> <kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> >> > +/* This structure is used for keeping LRU ordering of isolated page */
> >> > +struct pages_lru {
> >> > + Â Â Â Âstruct page *page; Â Â Â/* isolated page */
> >> > + Â Â Â Âstruct page *prev_page; /* previous page of isolate page as LRU order */
> >> > + Â Â Â Âstruct page *next_page; /* next page of isolate page as LRU order */
> >> > + Â Â Â Âstruct list_head lru;
> >> > +};
> >> > Â/*
> >>
> >> So this thing has to be allocated from somewhere. We can't put it
> >> on the stack as we're already in danger there so we must be using
> >> kmalloc. In the reclaim paths, this should be avoided obviously.
> >> For compaction, we might hurt the compaction success rates if pages
> >> are pinned with control structures. It's something to be wary of.
> >>
> >> At LSF/MM, I stated a preference for swapping the source and
> >> destination pages in the LRU. This unfortunately means that the LRU
> >> now contains a page in the process of being migrated to and the backout
> >> paths for migration failure become a lot more complex. Reclaim should
> >> be ok as it'll should fail to lock the page and recycle it in the list.
> >> This avoids allocations but I freely admit that I'm not in the position
> >> to implement such a thing right now :(
> >
> > I like swaping to fake page. one way pointer might become dangerous. vmscan can
> > detect fake page and ignore it.
>
>
> I guess it means swapping between migrated-from page and migrated-to page.
> Right?

no. I was intend to use fake struct page. but this idea is also good to me.

> If so, migrated-from page is already removed from LRU list and
> migrated-to page isn't LRU as it's page allocated newly so they don't
> have any LRU information. How can we swap them? We need space keeps
> LRU information before removing the page from LRU list. :(

pure fake struct page or preallocation migrated-to page?



>
> Could you explain in detail about swapping if I miss something?
>
> About one way pointer, I think it's no problem. Worst case I imagine
> is to put the page in head of LRU list. It means it's same issue now.
> So it doesn't make worse than now.
>
> >
> > ie,
> > is_fake_page(page)
> > {
> > Â Â Â Âif (is_stack_addr((void*)page))
> > Â Â Â Â Â Â Â Âreturn true;
> > Â Â Â Âreturn false;
> > }
> >
> > Also, I like to use stack rather than kmalloc in compaction.
> >
>
> Compaction is a procedure of reclaim. As you know, we had a problem
> about using of stack during reclaim path.
> I admit kmalloc-thing isn't good.
> I will try to solve the issue as TODO.

It depend on stack consumption size. because we don't call pageout()
from compaction path. It's big different from regular reclaim path.

>
> Thanks for the review, KOSAKI.

Yeah, thank you for making very good patch!



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/