[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090512205737.b27824a3.minchan.kim@barrios-desktop>
Date: Tue, 12 May 2009 20:57:37 +0900
From: Minchan Kim <minchan.kim@...il.com>
To: Wu Fengguang <fengguang.wu@...el.com>
Cc: Minchan Kim <minchan.kim@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"hannes@...xchg.org" <hannes@...xchg.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"riel@...hat.com" <riel@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"tytso@....edu" <tytso@....edu>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"elladan@...imo.com" <elladan@...imo.com>,
"npiggin@...e.de" <npiggin@...e.de>,
"cl@...ux-foundation.org" <cl@...ux-foundation.org>,
"kosaki.motohiro@...fujitsu.com" <kosaki.motohiro@...fujitsu.com>
Subject: Re: [PATCH -mm] vmscan: merge duplicate code in
shrink_active_list()
On Tue, 12 May 2009 19:48:07 +0800
Wu Fengguang <fengguang.wu@...el.com> wrote:
> On Tue, May 12, 2009 at 03:26:33PM +0800, Minchan Kim wrote:
> > On Tue, 12 May 2009 10:53:19 +0800
> > Wu Fengguang <fengguang.wu@...el.com> wrote:
> >
> > > The "move pages to active list" and "move pages to inactive list"
> > > code blocks are mostly identical and can be served by a function.
> > >
> > > Thanks to Andrew Morton for pointing this out.
> > >
> > > Signed-off-by: Wu Fengguang <fengguang.wu@...el.com>
> > > ---
> > > mm/vmscan.c | 84 ++++++++++++++++++++------------------------------
> > > 1 file changed, 35 insertions(+), 49 deletions(-)
> > >
> > > --- linux.orig/mm/vmscan.c
> > > +++ linux/mm/vmscan.c
> > > @@ -1225,6 +1225,36 @@ static inline void note_zone_scanning_pr
> > > * But we had to alter page->flags anyway.
> > > */
> > >
> > > +void move_active_pages_to_lru(enum lru_list lru, struct list_head *list)
> > > +{
> > > + unsigned long pgmoved = 0;
> > > +
> > > + while (!list_empty(&list)) {
> > > + page = lru_to_page(&list);
> > > + prefetchw_prev_lru_page(page, &list, flags);
> > > +
> > > + VM_BUG_ON(PageLRU(page));
> > > + SetPageLRU(page);
> > > +
> > > + VM_BUG_ON(!PageActive(page));
> > > + if (lru < LRU_ACTIVE)
> > > + ClearPageActive(page);
> >
> > Arithmetic on the LRU list is not good code for redability, I think.
> > How about adding comment?
> >
> > if (lru < LRU_ACTIVE) /* In case of moving from active list to inactive */
> >
> > Ignore me if you think this is trivial.
>
> Good suggestion. Or this simple one: "we are de-activating"?
>
Looks good to me :)
> Thanks,
> Fengguang
--
Kinds Regards
Minchan Kim
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists