Re: [PATCH 1/3] mm: pagevec: Defer deciding what LRU to add a pageto until pagevec drain time

From: Mel Gorman
Date: Fri May 03 2013 - 04:38:03 EST


On Fri, May 03, 2013 at 09:51:58AM +0200, Jan Kara wrote:
> > @@ -789,17 +787,16 @@ void lru_add_page_tail(struct page *page, struct page *page_tail,
> > static void __pagevec_lru_add_fn(struct page *page, struct lruvec *lruvec,
> > void *arg)
> > {
> > - enum lru_list lru = (enum lru_list)arg;
> > - int file = is_file_lru(lru);
> > - int active = is_active_lru(lru);
> > + enum lru_list requested_lru = (enum lru_list)arg;
> > + int file = page_is_file_cache(page);
> > + int active = PageActive(page);
> > + enum lru_list lru = page_lru(page);
> >
> > - VM_BUG_ON(PageActive(page));
> > + WARN_ON_ONCE(requested_lru < NR_LRU_LISTS && requested_lru != lru);
> Hum, so __lru_cache_add() calls this with 'requested_lru' set to whatever
> LRU we currently want to add a page. How should this always be equal to the
> LRU of all the pages we have cached in the pagevec?
>

It wouldn't necessarily be and and for a pagevec drain, it's ignored
completely.

> And if I'm right, there doesn't seem to be a reason to pass requested_lru
> to this function at all, does it?
>

You've already noticed that it gets thrown away later in the third
patch. It was left in this patch as a debugging aid in case there was a
direct pagevec user that expected to place pages on an LRU that was at
odds with the page flags.

--
Mel Gorman
SUSE Labs
--
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/