All of lore.kernel.org
 help / color / mirror / Atom feed
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Kyungmin Park <kmpark@infradead.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH] mm: cma: Discard clean pages during contiguous allocation instead of migration
Date: Thu, 13 Sep 2012 08:58:55 +0900	[thread overview]
Message-ID: <20120912235855.GB2766@bbox> (raw)
In-Reply-To: <20120912130732.99ecf764.akpm@linux-foundation.org>

On Wed, Sep 12, 2012 at 01:07:32PM -0700, Andrew Morton wrote:
> On Tue, 11 Sep 2012 09:41:52 +0900
> Minchan Kim <minchan@kernel.org> wrote:
> 
> > This patch drops clean cache pages instead of migration during
> > alloc_contig_range() to minimise allocation latency by reducing the amount
> > of migration is necessary. It's useful for CMA because latency of migration
> > is more important than evicting the background processes working set.
> > In addition, as pages are reclaimed then fewer free pages for migration
> > targets are required so it avoids memory reclaiming to get free pages,
> > which is a contributory factor to increased latency.
> > 
> > * from v1
> >   * drop migrate_mode_t
> >   * add reclaim_clean_pages_from_list instad of MIGRATE_DISCARD support - Mel
> > 
> > I measured elapsed time of __alloc_contig_migrate_range which migrates
> > 10M in 40M movable zone in QEMU machine.
> > 
> > Before - 146ms, After - 7ms
> > 
> > ...
> >
> > @@ -758,7 +760,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> >  			wait_on_page_writeback(page);
> >  		}
> >  
> > -		references = page_check_references(page, sc);
> > +		if (!force_reclaim)
> > +			references = page_check_references(page, sc);
> 
> grumble.  Could we please document `enum page_references' and
> page_check_references()?
> 
> And the `force_reclaim' arg could do with some documentation.  It only
> forces reclaim under certain circumstances.  They should be described,
> and a reson should be provided.

I will give it a shot by another patch.

> 
> Why didn't this patch use PAGEREF_RECLAIM_CLEAN?  It is possible for
> someone to dirty one of these pages after we tested its cleanness and
> we'll then go off and write it out, but we won't be reclaiming it?

Absolutely.
Thanks Andrew!

Here it goes.

====== 8< ======

WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Kyungmin Park <kmpark@infradead.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Michal Nazarewicz <mina86@mina86.com>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH] mm: cma: Discard clean pages during contiguous allocation instead of migration
Date: Thu, 13 Sep 2012 08:58:55 +0900	[thread overview]
Message-ID: <20120912235855.GB2766@bbox> (raw)
In-Reply-To: <20120912130732.99ecf764.akpm@linux-foundation.org>

On Wed, Sep 12, 2012 at 01:07:32PM -0700, Andrew Morton wrote:
> On Tue, 11 Sep 2012 09:41:52 +0900
> Minchan Kim <minchan@kernel.org> wrote:
> 
> > This patch drops clean cache pages instead of migration during
> > alloc_contig_range() to minimise allocation latency by reducing the amount
> > of migration is necessary. It's useful for CMA because latency of migration
> > is more important than evicting the background processes working set.
> > In addition, as pages are reclaimed then fewer free pages for migration
> > targets are required so it avoids memory reclaiming to get free pages,
> > which is a contributory factor to increased latency.
> > 
> > * from v1
> >   * drop migrate_mode_t
> >   * add reclaim_clean_pages_from_list instad of MIGRATE_DISCARD support - Mel
> > 
> > I measured elapsed time of __alloc_contig_migrate_range which migrates
> > 10M in 40M movable zone in QEMU machine.
> > 
> > Before - 146ms, After - 7ms
> > 
> > ...
> >
> > @@ -758,7 +760,9 @@ static unsigned long shrink_page_list(struct list_head *page_list,
> >  			wait_on_page_writeback(page);
> >  		}
> >  
> > -		references = page_check_references(page, sc);
> > +		if (!force_reclaim)
> > +			references = page_check_references(page, sc);
> 
> grumble.  Could we please document `enum page_references' and
> page_check_references()?
> 
> And the `force_reclaim' arg could do with some documentation.  It only
> forces reclaim under certain circumstances.  They should be described,
> and a reson should be provided.

I will give it a shot by another patch.

> 
> Why didn't this patch use PAGEREF_RECLAIM_CLEAN?  It is possible for
> someone to dirty one of these pages after we tested its cleanness and
> we'll then go off and write it out, but we won't be reclaiming it?

Absolutely.
Thanks Andrew!

Here it goes.

====== 8< ======

>From 90022feb9ecf8e9a4efba7cbf49d7cead777020f Mon Sep 17 00:00:00 2001
From: Minchan Kim <minchan@kernel.org>
Date: Thu, 13 Sep 2012 08:45:58 +0900
Subject: [PATCH] mm: cma: reclaim only clean pages

It is possible for pages to be dirty after the check
in reclaim_clean_pages_from_list so that it ends up
paging out the pages, which is never what we want for speed up.

This patch fixes it.

Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Michal Nazarewicz <mina86@mina86.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Minchan Kim <minchan@kernel.org>
---
 mm/vmscan.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8f56f8..1ee4b69 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -694,7 +694,7 @@ static unsigned long shrink_page_list(struct list_head *page_list,
 		struct address_space *mapping;
 		struct page *page;
 		int may_enter_fs;
-		enum page_references references = PAGEREF_RECLAIM;
+		enum page_references references = PAGEREF_RECLAIM_CLEAN;
 
 		cond_resched();
 
-- 
1.7.9.5

-- 
Kind regards,
Minchan Kim

  reply	other threads:[~2012-09-12 23:56 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11  0:41 [PATCH] mm: cma: Discard clean pages during contiguous allocation instead of migration Minchan Kim
2012-09-11  0:41 ` Minchan Kim
2012-09-11  8:59 ` Mel Gorman
2012-09-11  8:59   ` Mel Gorman
2012-09-11 11:15 ` Michal Nazarewicz
2012-09-11 11:15   ` Michal Nazarewicz
2012-09-11 11:23   ` Kyungmin Park
2012-09-11 11:23     ` Kyungmin Park
2012-09-12 20:07 ` Andrew Morton
2012-09-12 20:07   ` Andrew Morton
2012-09-12 23:58   ` Minchan Kim [this message]
2012-09-12 23:58     ` Minchan Kim
2012-09-13 19:17 ` Geert Uytterhoeven
2012-09-13 19:17   ` Geert Uytterhoeven
2012-09-13 22:19   ` Andrew Morton
2012-09-13 22:19     ` Andrew Morton
2012-09-14  0:10     ` Minchan Kim
2012-09-14  0:10       ` Minchan Kim

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=20120912235855.GB2766@bbox \
    --to=minchan@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=kmpark@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mgorman@suse.de \
    --cc=mina86@mina86.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.