All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Vincent Li <macli@brc.ubc.ca>,
	kosaki.motohiro@jp.fujitsu.com, riel@redhat.com,
	fengguang.wu@intel.com, linux-mm@kvack.org
Subject: Re: [RESEND][PATCH V1] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value.
Date: Thu, 3 Sep 2009 19:01:41 -0700	[thread overview]
Message-ID: <20090903190141.16ce4cf3.akpm@linux-foundation.org> (raw)
In-Reply-To: <28c262360909031837j4e1a9214if6070d02cb4fde04@mail.gmail.com>

On Fri, 4 Sep 2009 10:37:17 +0900 Minchan Kim <minchan.kim@gmail.com> wrote:

> On Fri, Sep 4, 2009 at 6:06 AM, Andrew Morton<akpm@linux-foundation.org> wrote:
> > On Wed, __2 Sep 2009 16:49:25 -0700
> > Vincent Li <macli@brc.ubc.ca> wrote:
> >
> >> If we can't isolate pages from LRU list, we don't have to account page movement, either.
> >> Already, in commit 5343daceec, KOSAKI did it about shrink_inactive_list.
> >>
> >> This patch removes unnecessary overhead of page accounting
> >> and locking in shrink_active_list as follow-up work of commit 5343daceec.
> >>
> >> Signed-off-by: Vincent Li <macli@brc.ubc.ca>
> >> Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
> >> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> >> Reviewed-by: Wu Fengguang <fengguang.wu@intel.com>
> >> Acked-by: Rik van Riel <riel@redhat.com>
> >>
> >> ---
> >> __mm/vmscan.c | __ __9 +++++++--
> >> __1 files changed, 7 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/mm/vmscan.c b/mm/vmscan.c
> >> index 460a6f7..2d1c846 100644
> >> --- a/mm/vmscan.c
> >> +++ b/mm/vmscan.c
> >> @@ -1319,9 +1319,12 @@ static void shrink_active_list(unsigned long nr_pages, struct zone *zone,
> >> __ __ __ if (scanning_global_lru(sc)) {
> >> __ __ __ __ __ __ __ zone->pages_scanned += pgscanned;

Someone's email client is replacing 0x09 with 0xa0, dammit.

> >
> > IOW, with what frequency is `nr_taken' zero here?
> 
> I think It's not so simple.
> 
> In fact, the probability of (nr_taken == 0)
> would be very low in active list.
> 
> If we verify the benefit, we have to measure trade-off between
> loss of compare instruction in most case and
> gain of avoiding unnecessary overheads in rare case through
> micro-benchmark. I don't know which benchmark can do it.
> 
> but if we can know the number of frequent and it's very low,
> we can add 'unlikely(if (nr_taken==0))' at least, I think.

But the test-n-branch is not the only cost of this change.

The more worrisome effect is that we've added a rarely-taken long
branch which skips over a whole lot of code.  There's an appreciable
risk that we'll later add code to this function in the expectation that
the new code is always executed.  During testing, the code is executed
sufficiently often for the bug to not be noticed.  So we ship the buggy
code.

IOW, there is a maintainability cost as well.

--
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-09-04  2:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-02 23:49 [RESEND][PATCH V1] mm/vsmcan: check shrink_active_list() sc->isolate_pages() return value Vincent Li
2009-09-03 21:06 ` Andrew Morton
2009-09-03 22:02   ` Vincent Li
2009-09-03 22:47     ` Andrew Morton
2009-09-04 21:39       ` Vincent Li
2009-09-04 23:53         ` Andrew Morton
2009-09-08 13:21           ` Mel Gorman
2009-09-08 22:39             ` Vincent Li
2009-09-08 23:27               ` Minchan Kim
2009-10-15 22:47                 ` Vincent Li
2009-10-15 23:13                   ` Vincent Li
2009-10-16  2:10                   ` Minchan Kim
2009-10-16  2:20                     ` Wu Fengguang
2009-10-16  3:05                       ` KOSAKI Motohiro
2009-10-16  3:26                         ` Vincent Li
2009-11-26  4:56                         ` KOSAKI Motohiro
2009-09-09  9:59               ` Mel Gorman
2009-09-04  1:37   ` Minchan Kim
2009-09-04  2:01     ` Andrew Morton [this message]
2009-09-04  5:01       ` Vincent Li
2009-09-04 16:05         ` Vincent Li
2009-09-06 23:38           ` KOSAKI Motohiro
2009-09-08 18:32             ` Vincent Li
2009-09-08 23:47               ` KOSAKI Motohiro
2009-09-09 12:04               ` Johannes Weiner
2009-09-09 13:22                 ` Minchan Kim
2009-09-22 21:02 ` Andrew Morton
2009-09-22 23:01   ` Vincent Li

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=20090903190141.16ce4cf3.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=macli@brc.ubc.ca \
    --cc=minchan.kim@gmail.com \
    --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.