All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Avi Kivity <avi@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Dike, Jeffrey G" <jeffrey.g.dike@intel.com>,
	Hugh Dickins <hugh.dickins@tiscali.co.uk>,
	Christoph Lameter <cl@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>, LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"lizf@cn.fujitsu.com" <lizf@cn.fujitsu.com>,
	"menage@google.com" <menage@google.com>
Subject: Re: [RFC][PATCH] mm: remove unnecessary loop inside shrink_inactive_list()
Date: Fri, 21 Aug 2009 19:22:28 +0800	[thread overview]
Message-ID: <20090821112228.GA6457@localhost> (raw)
In-Reply-To: <2f11576a0908210409p3f1551a4i194887abbad94e9b@mail.gmail.com>

On Fri, Aug 21, 2009 at 07:09:17PM +0800, KOSAKI Motohiro wrote:
> 2009/8/20 Wu Fengguang <fengguang.wu@intel.com>:
> > shrink_inactive_list() won't be called to scan too much pages
> > (unless in hibernation code which is fine) or too few pages (ie.
> > batching is taken care of by the callers).  So we can just remove the
> > big loop and isolate the exact number of pages requested.
> >
> > Just a RFC, and a scratch patch to show the basic idea.
> > Please kindly NAK quick if you don't like it ;)
> 
> Hm, I think this patch taks only cleanups. right?
> if so, I don't find any objection reason.

Mostly cleanups, but one behavior change here: 

> > -               nr_taken = sc->isolate_pages(sc->swap_cluster_max,
> > +               nr_taken = sc->isolate_pages(nr_to_scan,
> >                             &page_list, &nr_scan, sc->order, mode,
> >                                zone, sc->mem_cgroup, 0, file);

The new behavior is to scan exactly the number of pages that
shrink_zone() or other callers tell it. It won't try to "round it up"
to 32 pages. This new behavior is in line with shrink_active_list()'s
current status as well as shrink_zone()'s expectation.

shrink_zone() may still submit scan requests for <32 pages, which is
suboptimal. I'll try to eliminate that totally with more patches.

> >                nr_active = clear_active_flags(&page_list, count);
> > @@ -1093,7 +1095,6 @@ static unsigned long shrink_inactive_lis
> >
> >                spin_unlock_irq(&zone->lru_lock);
> >
> > -               nr_scanned += nr_scan;
> >                nr_freed = shrink_page_list(&page_list, sc, PAGEOUT_IO_ASYNC);
> >
> >                /*
> > @@ -1117,7 +1118,7 @@ static unsigned long shrink_inactive_lis
> >                                                        PAGEOUT_IO_SYNC);
> >                }
> >
> > -               nr_reclaimed += nr_freed;
> > +               nr_reclaimed = nr_freed;
> 
> maybe, nr_freed can be removed perfectly. it have the same meaning as
> nr_reclaimed.

Yes, good spot!

Thanks,
Fengguang

WARNING: multiple messages have this Message-ID (diff)
From: Wu Fengguang <fengguang.wu@intel.com>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	Rik van Riel <riel@redhat.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Avi Kivity <avi@redhat.com>,
	Andrea Arcangeli <aarcange@redhat.com>,
	"Dike, Jeffrey G" <jeffrey.g.dike@intel.com>,
	Hugh Dickins <hugh.dickins@tiscali.co.uk>,
	Christoph Lameter <cl@linux-foundation.org>,
	Mel Gorman <mel@csn.ul.ie>, LKML <linux-kernel@vger.kernel.org>,
	linux-mm <linux-mm@kvack.org>,
	"nishimura@mxp.nes.nec.co.jp" <nishimura@mxp.nes.nec.co.jp>,
	"lizf@cn.fujitsu.com" <lizf@cn.fujitsu.com>,
	"menage@google.com" <menage@google.com>
Subject: Re: [RFC][PATCH] mm: remove unnecessary loop inside shrink_inactive_list()
Date: Fri, 21 Aug 2009 19:22:28 +0800	[thread overview]
Message-ID: <20090821112228.GA6457@localhost> (raw)
In-Reply-To: <2f11576a0908210409p3f1551a4i194887abbad94e9b@mail.gmail.com>

On Fri, Aug 21, 2009 at 07:09:17PM +0800, KOSAKI Motohiro wrote:
> 2009/8/20 Wu Fengguang <fengguang.wu@intel.com>:
> > shrink_inactive_list() won't be called to scan too much pages
> > (unless in hibernation code which is fine) or too few pages (ie.
> > batching is taken care of by the callers). A So we can just remove the
> > big loop and isolate the exact number of pages requested.
> >
> > Just a RFC, and a scratch patch to show the basic idea.
> > Please kindly NAK quick if you don't like it ;)
> 
> Hm, I think this patch taks only cleanups. right?
> if so, I don't find any objection reason.

Mostly cleanups, but one behavior change here: 

> > - A  A  A  A  A  A  A  nr_taken = sc->isolate_pages(sc->swap_cluster_max,
> > + A  A  A  A  A  A  A  nr_taken = sc->isolate_pages(nr_to_scan,
> > A  A  A  A  A  A  A  A  A  A  A  A  A  A  &page_list, &nr_scan, sc->order, mode,
> > A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A zone, sc->mem_cgroup, 0, file);

The new behavior is to scan exactly the number of pages that
shrink_zone() or other callers tell it. It won't try to "round it up"
to 32 pages. This new behavior is in line with shrink_active_list()'s
current status as well as shrink_zone()'s expectation.

shrink_zone() may still submit scan requests for <32 pages, which is
suboptimal. I'll try to eliminate that totally with more patches.

> > A  A  A  A  A  A  A  A nr_active = clear_active_flags(&page_list, count);
> > @@ -1093,7 +1095,6 @@ static unsigned long shrink_inactive_lis
> >
> > A  A  A  A  A  A  A  A spin_unlock_irq(&zone->lru_lock);
> >
> > - A  A  A  A  A  A  A  nr_scanned += nr_scan;
> > A  A  A  A  A  A  A  A nr_freed = shrink_page_list(&page_list, sc, PAGEOUT_IO_ASYNC);
> >
> > A  A  A  A  A  A  A  A /*
> > @@ -1117,7 +1118,7 @@ static unsigned long shrink_inactive_lis
> > A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A  A PAGEOUT_IO_SYNC);
> > A  A  A  A  A  A  A  A }
> >
> > - A  A  A  A  A  A  A  nr_reclaimed += nr_freed;
> > + A  A  A  A  A  A  A  nr_reclaimed = nr_freed;
> 
> maybe, nr_freed can be removed perfectly. it have the same meaning as
> nr_reclaimed.

Yes, good spot!

Thanks,
Fengguang

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2009-08-21 11:22 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-20  2:49 [PATCH] mm: do batched scans for mem_cgroup Wu Fengguang
2009-08-20  2:49 ` Wu Fengguang
2009-08-20  2:52 ` [PATCH] mm: make nr_scan_try_batch() more safe on races Wu Fengguang
2009-08-20  2:52   ` Wu Fengguang
2009-08-20  3:17   ` [RFC][PATCH] mm: remove unnecessary loop inside shrink_inactive_list() Wu Fengguang
2009-08-20  3:17     ` Wu Fengguang
2009-08-21 11:09     ` KOSAKI Motohiro
2009-08-21 11:09       ` KOSAKI Motohiro
2009-08-21 11:22       ` Wu Fengguang [this message]
2009-08-21 11:22         ` Wu Fengguang
2009-08-27  0:20         ` KOSAKI Motohiro
2009-08-27  0:20           ` KOSAKI Motohiro
2009-08-20  3:13 ` [PATCH] mm: do batched scans for mem_cgroup KAMEZAWA Hiroyuki
2009-08-20  3:13   ` KAMEZAWA Hiroyuki
2009-08-20  4:05   ` [PATCH -v2] " Wu Fengguang
2009-08-20  4:05     ` Wu Fengguang
2009-08-20  4:06     ` KAMEZAWA Hiroyuki
2009-08-20  4:06       ` KAMEZAWA Hiroyuki
2009-08-20  5:16     ` Balbir Singh
2009-08-20  5:16       ` Balbir Singh
2009-08-21  1:39       ` Wu Fengguang
2009-08-21  1:39         ` Wu Fengguang
2009-08-21  1:46         ` Wu Fengguang
2009-08-21  1:46           ` Wu Fengguang
2009-08-20 11:01     ` Minchan Kim
2009-08-20 11:01       ` Minchan Kim
2009-08-20 11:49       ` Wu Fengguang
2009-08-20 11:49         ` Wu Fengguang
2009-08-20 12:13         ` Minchan Kim
2009-08-20 12:13           ` Minchan Kim
2009-08-20 12:32           ` Wu Fengguang
2009-08-20 12:32             ` Wu Fengguang
2009-08-21  3:55     ` Minchan Kim
2009-08-21  3:55       ` Minchan Kim
2009-08-21  7:27       ` [PATCH -v2 changelog updated] " Wu Fengguang
2009-08-21  7:27         ` Wu Fengguang
2009-08-21 10:57         ` KOSAKI Motohiro
2009-08-21 10:57           ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090821112228.GA6457@localhost \
    --to=fengguang.wu@intel.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=avi@redhat.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=cl@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=jeffrey.g.dike@intel.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=mel@csn.ul.ie \
    --cc=menage@google.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.