linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier
@ 2016-06-29  5:42 Hillf Danton
  2016-07-11 22:20 ` Andrew Morton
  0 siblings, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2016-06-29  5:42 UTC (permalink / raw)
  To: 'Mel Gorman'
  Cc: 'Johannes Weiner', 'Vlastimil Babka',
	'linux-kernel', linux-mm, 'Andrew Morton'

To avoid excessive reclaim, we give up rebalancing for high order 
allocations right after reclaiming enough pages.

Signed-off-by: Hillf Danton <hillf.zj@alibaba-inc.com>
---

 mm/vmscan.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index ee7e531..d080fb2 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3159,8 +3159,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx)
 
 	do {
 		bool raise_priority = true;
-
-		sc.nr_reclaimed = 0;
+		unsigned long reclaimed_pages = sc.nr_reclaimed;
 
 		/*
 		 * If the number of buffer_heads in the machine exceeds the
@@ -3254,7 +3253,7 @@ static int balance_pgdat(pg_data_t *pgdat, int order, int classzone_idx)
 		 * Raise priority if scanning rate is too low or there was no
 		 * progress in reclaiming pages
 		 */
-		if (raise_priority || !sc.nr_reclaimed)
+		if (raise_priority || sc.nr_reclaimed == reclaimed_pages)
 			sc.priority--;
 	} while (sc.priority >= 1);
 
--

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier
  2016-06-29  5:42 [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier Hillf Danton
@ 2016-07-11 22:20 ` Andrew Morton
  2016-07-12  6:32   ` Hillf Danton
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2016-07-11 22:20 UTC (permalink / raw)
  To: Hillf Danton
  Cc: 'Mel Gorman', 'Johannes Weiner',
	'Vlastimil Babka', 'linux-kernel',
	linux-mm

On Wed, 29 Jun 2016 13:42:12 +0800 "Hillf Danton" <hillf.zj@alibaba-inc.com> wrote:

> To avoid excessive reclaim, we give up rebalancing for high order 
> allocations right after reclaiming enough pages.

hm.  What are the observed runtime effects of this change?  Any testing
results?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier
  2016-07-11 22:20 ` Andrew Morton
@ 2016-07-12  6:32   ` Hillf Danton
  2016-07-12  8:33     ` Mel Gorman
  0 siblings, 1 reply; 5+ messages in thread
From: Hillf Danton @ 2016-07-12  6:32 UTC (permalink / raw)
  To: 'Andrew Morton'
  Cc: 'Mel Gorman', 'Johannes Weiner',
	'Vlastimil Babka', 'linux-kernel',
	linux-mm

> > To avoid excessive reclaim, we give up rebalancing for high order
> > allocations right after reclaiming enough pages.
> 
> hm.  What are the observed runtime effects of this change?  Any testing
> results?
> 
This work was based on Mel's work, Sir,
"[PATCH 00/27] Move LRU page reclaim from zones to nodes v7".

In "[PATCH 06/27] mm, vmscan: Make kswapd reclaim in terms of nodes", 
fragmentation detection is introduced to avoid excessive reclaim. We bail 
out of balancing for high-order allocations if the pages reclaimed at the 
__current__ reclaim priority are two times more than required.

In this work we give up reclaiming for high-order allocations if the 
__total__ number of pages reclaimed, from the first priority to the 
current priority, is more than needed, and in net result we reclaim less 
pages.

Given " [PATCH 00/34] Move LRU page reclaim from zones to nodes v9" 
is delivered, I will send this work if necessary, after Mel's work landing 
in the -mm tree.

thanks
Hillf

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier
  2016-07-12  6:32   ` Hillf Danton
@ 2016-07-12  8:33     ` Mel Gorman
  2016-07-12  8:48       ` Hillf Danton
  0 siblings, 1 reply; 5+ messages in thread
From: Mel Gorman @ 2016-07-12  8:33 UTC (permalink / raw)
  To: Hillf Danton
  Cc: 'Andrew Morton', 'Johannes Weiner',
	'Vlastimil Babka', 'linux-kernel',
	linux-mm

On Tue, Jul 12, 2016 at 02:32:45PM +0800, Hillf Danton wrote:
> > > To avoid excessive reclaim, we give up rebalancing for high order
> > > allocations right after reclaiming enough pages.
> > 
> > hm.  What are the observed runtime effects of this change?  Any testing
> > results?
> > 
> This work was based on Mel's work, Sir,
> "[PATCH 00/27] Move LRU page reclaim from zones to nodes v7".
> 

I believe Andrew understands that but the question is what is the
observed runtime effect of the patch?

> In "[PATCH 06/27] mm, vmscan: Make kswapd reclaim in terms of nodes", 
> fragmentation detection is introduced to avoid excessive reclaim. We bail 
> out of balancing for high-order allocations if the pages reclaimed at the 
> __current__ reclaim priority are two times more than required.
> 
> In this work we give up reclaiming for high-order allocations if the 
> __total__ number of pages reclaimed, from the first priority to the 
> current priority, is more than needed, and in net result we reclaim less 
> pages.
> 

While it's clear what it does, it is not clear if it is an improvement. I had
read the patch, considered merging it and decided against it. This decision
was based on the fact the series did not appear to be over-reclaiming for
high-order pages when compared with zone-lru.

Did you test this patch with a workload that requires a lot of high-order
pages and see if kswapd was over-reclaiming and that this patch addressed
the issue?

-- 
Mel Gorman
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier
  2016-07-12  8:33     ` Mel Gorman
@ 2016-07-12  8:48       ` Hillf Danton
  0 siblings, 0 replies; 5+ messages in thread
From: Hillf Danton @ 2016-07-12  8:48 UTC (permalink / raw)
  To: 'Mel Gorman'
  Cc: 'Andrew Morton', 'Johannes Weiner',
	'Vlastimil Babka', 'linux-kernel',
	linux-mm

> This decision
> was based on the fact the series did not appear to be over-reclaiming for
> high-order pages when compared with zone-lru.
> 
Then dropped.

thanks
Hillf

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-07-12  8:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-29  5:42 [PATCH] mm, vmscan: Give up balancing node for high order allocations earlier Hillf Danton
2016-07-11 22:20 ` Andrew Morton
2016-07-12  6:32   ` Hillf Danton
2016-07-12  8:33     ` Mel Gorman
2016-07-12  8:48       ` Hillf Danton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).