linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Minchan Kim <minchan.kim@gmail.com>
Cc: Jack Steiner <steiner@sgi.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Mel Gorman <mel@csn.ul.ie>
Subject: Re: [PATCH] - Improve drain pages performance on large systems
Date: Tue, 15 Feb 2011 19:01:34 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1102151858580.19953@chino.kir.corp.google.com> (raw)
In-Reply-To: <AANLkTim+rjN8GMwOV5MLeVjXaevHmCciAc5DwQXgiO62@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2392 bytes --]

On Wed, 16 Feb 2011, Minchan Kim wrote:

> > Index: linux/mm/page_alloc.c
> > ===================================================================
> > --- linux.orig/mm/page_alloc.c A 2011-02-15 16:28:36.165921713 -0600
> > +++ linux/mm/page_alloc.c A  A  A  2011-02-15 16:29:43.085502487 -0600
> > @@ -592,10 +592,24 @@ static void free_pcppages_bulk(struct zo
> > A  A  A  A int batch_free = 0;
> > A  A  A  A int to_free = count;
> >
> > + A  A  A  /*
> > + A  A  A  A * Quick scan of zones. If all are empty, there is nothing to do.
> > + A  A  A  A */
> > + A  A  A  for (migratetype = 0; migratetype < MIGRATE_PCPTYPES; migratetype++) {
> > + A  A  A  A  A  A  A  struct list_head *list;
> > +
> > + A  A  A  A  A  A  A  list = &pcp->lists[migratetype];
> > + A  A  A  A  A  A  A  if (!list_empty(list))
> > + A  A  A  A  A  A  A  A  A  A  A  break;
> > + A  A  A  }
> > + A  A  A  if (migratetype == MIGRATE_PCPTYPES)
> > + A  A  A  A  A  A  A  return;
> > +
> > A  A  A  A spin_lock(&zone->lock);
> > A  A  A  A zone->all_unreclaimable = 0;
> > A  A  A  A zone->pages_scanned = 0;
> >
> > + A  A  A  migratetype = 0;
> > A  A  A  A while (to_free) {
> > A  A  A  A  A  A  A  A struct page *page;
> > A  A  A  A  A  A  A  A struct list_head *list;
> 
> It does make sense to me.
> Although new code looks to be rather costly in small box, anyway we
> use the same logic  in while loop so cache would be hot. so cost would
> be little.
> 

I was going to mention the implications for small machines as well, this 
doesn't look good for callers that know free_pcppages_bulk() will do 
something.

> But how about this? This one never affect fast-critical path.
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index ff7e158..2dfb61a 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1095,8 +1095,10 @@ static void drain_pages(unsigned int cpu)
>                 pset = per_cpu_ptr(zone->pageset, cpu);
> 
>                 pcp = &pset->pcp;
> -               free_pcppages_bulk(zone, pcp->count, pcp);
> -               pcp->count = 0;
> +               if (pcp->count > 0) {
> +                       free_pcppages_bulk(zone, pcp->count, pcp);
> +                       pcp->count = 0;
> +               }
>                 local_irq_restore(flags);
>         }
>  }

Right, this is 2ff754fa upstream.  I'm wondering if Jack still sees the 
same problem since 2.6.38-rc3.

  reply	other threads:[~2011-02-16  3:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15 22:38 Jack Steiner
2011-02-16  0:00 ` Minchan Kim
2011-02-16  3:01   ` David Rientjes [this message]
2011-02-16 15:43   ` Jack Steiner
2011-02-16  0:17 ` Andi Kleen

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=alpine.DEB.2.00.1102151858580.19953@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mel@csn.ul.ie \
    --cc=minchan.kim@gmail.com \
    --cc=steiner@sgi.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox