lkml.org 
[lkml]   [2011]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] mm: compaction: Abort compaction if too many pages are isolated and caller is asynchronous
On Mon, Jun 06, 2011 at 11:39:24AM +0100, Mel Gorman wrote:
> On Fri, Jun 03, 2011 at 05:45:54PM +0200, Andrea Arcangeli wrote:
> > On Fri, Jun 03, 2011 at 03:49:41PM +0100, Mel Gorman wrote:
> > > Right idea of the wrong zone being accounted for but wrong place. I
> > > think the following patch should fix the problem;
> >
> > Looks good thanks.
> >
> > I also found this bug during my debugging that made NR_SHMEM underflow.
> >
> > ===
> > Subject: migrate: don't account swapcache as shmem
> >
> > From: Andrea Arcangeli <aarcange@redhat.com>
> >
> > swapcache will reach the below code path in migrate_page_move_mapping,
> > and swapcache is accounted as NR_FILE_PAGES but it's not accounted as
> > NR_SHMEM.
> >
> > Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
>
> Well spotted.
>
> Acked-by: Mel Gorman <mgorman@suse.de>
>
> Minor nit. swapper_space is rarely referred to outside of the swap
> code. Might it be more readable to use
>
> /*
> * swapcache is accounted as NR_FILE_PAGES but it is not
> * accounted as NR_SHMEM
> *
> if (PageSwapBacked(page) && !PageSwapCache(page))

I like this. but as it's "and" operation, CPU have to execute two condition comparison.
but how about below?
if (!PageSwapCache(page) && PageSwapBacked(page))

PageSwapCache implys PageSwapBacked so we can handle non-swapbacked pages as just 1 comparison.

>
> ?
>
> > ---
> >
> > diff --git a/mm/migrate.c b/mm/migrate.c
> > index e4a5c91..2597a27 100644
> > --- a/mm/migrate.c
> > +++ b/mm/migrate.c
> > @@ -288,7 +288,7 @@ static int migrate_page_move_mapping(struct address_space *mapping,
> > */
> > __dec_zone_page_state(page, NR_FILE_PAGES);
> > __inc_zone_page_state(newpage, NR_FILE_PAGES);
> > - if (PageSwapBacked(page)) {
> > + if (mapping != &swapper_space && PageSwapBacked(page)) {
> > __dec_zone_page_state(page, NR_SHMEM);
> > __inc_zone_page_state(newpage, NR_SHMEM);
> > }
> >
> >
>
> --
> Mel Gorman
> SUSE Labs

--
Kind regards
Minchan Kim


\
 
 \ /
  Last update: 2011-06-06 16:23    [W:0.190 / U:1.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site