linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: vmscan: fix setting reclaim mode
@ 2012-01-08  7:05 Hillf Danton
  2012-01-10  9:44 ` Mel Gorman
  0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2012-01-08  7:05 UTC (permalink / raw)
  To: linux-mm
  Cc: KAMEZAWA Hiroyuki, David Rientjes, Mel Gorman, Andrew Morton,
	LKML, Hillf Danton

The check for under memory pressure is corrected, then lumpy reclaim or
reclaim/compaction could be avoided either when for order-O reclaim or
when free pages are already low enough.


Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/vmscan.c	Thu Dec 29 20:20:16 2011
+++ b/mm/vmscan.c	Sun Jan  8 13:22:12 2012
@@ -365,8 +365,7 @@ out:
 	return ret;
 }

-static void set_reclaim_mode(int priority, struct scan_control *sc,
-				   bool sync)
+static void set_reclaim_mode(int priority, struct scan_control *sc, bool sync)
 {
 	reclaim_mode_t syncmode = sync ? RECLAIM_MODE_SYNC : RECLAIM_MODE_ASYNC;

@@ -381,13 +380,12 @@ static void set_reclaim_mode(int priorit
 		sc->reclaim_mode = RECLAIM_MODE_LUMPYRECLAIM;

 	/*
-	 * Avoid using lumpy reclaim or reclaim/compaction if possible by
-	 * restricting when its set to either costly allocations or when
-	 * under memory pressure
+	 * Avoid lumpy reclaim or reclaim/compaction either
+	 * when for order-O reclaim or when under memory pressure
 	 */
 	if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
 		sc->reclaim_mode |= syncmode;
-	else if (sc->order && priority < DEF_PRIORITY - 2)
+	else if (sc->order && priority >= DEF_PRIORITY - 2)
 		sc->reclaim_mode |= syncmode;
 	else
 		sc->reclaim_mode = RECLAIM_MODE_SINGLE | RECLAIM_MODE_ASYNC;

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

* Re: [PATCH] mm: vmscan: fix setting reclaim mode
  2012-01-08  7:05 [PATCH] mm: vmscan: fix setting reclaim mode Hillf Danton
@ 2012-01-10  9:44 ` Mel Gorman
  2012-01-10 15:58   ` Hillf Danton
  0 siblings, 1 reply; 6+ messages in thread
From: Mel Gorman @ 2012-01-10  9:44 UTC (permalink / raw)
  To: Hillf Danton
  Cc: linux-mm, KAMEZAWA Hiroyuki, David Rientjes, Andrew Morton, LKML

On Sun, Jan 08, 2012 at 03:05:03PM +0800, Hillf Danton wrote:
> The check for under memory pressure is corrected, then lumpy reclaim or
> reclaim/compaction could be avoided either when for order-O reclaim or
> when free pages are already low enough.
> 

No explanation of problem, how this patch fixes it or what the impact
is.

At a glance, this will have the impact of using sync reclaim at low
reclaim priorities. This is unexpected so needs much better explanation.

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH] mm: vmscan: fix setting reclaim mode
  2012-01-10  9:44 ` Mel Gorman
@ 2012-01-10 15:58   ` Hillf Danton
  2012-01-10 16:44     ` Mel Gorman
  0 siblings, 1 reply; 6+ messages in thread
From: Hillf Danton @ 2012-01-10 15:58 UTC (permalink / raw)
  To: Mel Gorman
  Cc: linux-mm, KAMEZAWA Hiroyuki, David Rientjes, Andrew Morton, LKML

On Tue, Jan 10, 2012 at 5:44 PM, Mel Gorman <mgorman@suse.de> wrote:
> On Sun, Jan 08, 2012 at 03:05:03PM +0800, Hillf Danton wrote:
>> The check for under memory pressure is corrected, then lumpy reclaim or
>> reclaim/compaction could be avoided either when for order-O reclaim or
>> when free pages are already low enough.
>>
>
> No explanation of problem, how this patch fixes it or what the impact
> is.
>
> At a glance, this will have the impact of using sync reclaim at low
> reclaim priorities. This is unexpected so needs much better explanation.
>

Hi Mel

It is reprepared, please review again.

Thanks
Hillf

===cut please===
From: Hillf Danton <dhillf@gmail.com>
[PATCH] mm: vmscan: fix setting reclaim mode

The comment says, initially assume we are entering either lumpy reclaim or
reclaim/compaction, and depending on the reclaim order, we will either set the
sync mode or just reclaim order-0 pages later.

On other hand, order-0 reclaim, instead of sync reclaim, is expected when
under memory pressure, but the check for memory pressure is incorrect,
leading to sync reclaim at low reclaim priorities.

And the result is sync reclaim is set for high priorities.


Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Hillf Danton <dhillf@gmail.com>
---

--- a/mm/vmscan.c	Thu Dec 29 20:20:16 2011
+++ b/mm/vmscan.c	Tue Jan 10 23:03:48 2012
@@ -387,7 +387,7 @@ static void set_reclaim_mode(int priorit
 	 */
 	if (sc->order > PAGE_ALLOC_COSTLY_ORDER)
 		sc->reclaim_mode |= syncmode;
-	else if (sc->order && priority < DEF_PRIORITY - 2)
+	else if (sc->order && priority >= DEF_PRIORITY - 2)
 		sc->reclaim_mode |= syncmode;
 	else
 		sc->reclaim_mode = RECLAIM_MODE_SINGLE | RECLAIM_MODE_ASYNC;

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

* Re: [PATCH] mm: vmscan: fix setting reclaim mode
  2012-01-10 15:58   ` Hillf Danton
@ 2012-01-10 16:44     ` Mel Gorman
  2012-01-10 16:58       ` Hillf Danton
  2012-01-11 12:12       ` Hillf Danton
  0 siblings, 2 replies; 6+ messages in thread
From: Mel Gorman @ 2012-01-10 16:44 UTC (permalink / raw)
  To: Hillf Danton
  Cc: linux-mm, KAMEZAWA Hiroyuki, David Rientjes, Andrew Morton, LKML

On Tue, Jan 10, 2012 at 11:58:03PM +0800, Hillf Danton wrote:
> From: Hillf Danton <dhillf@gmail.com>
> [PATCH] mm: vmscan: fix setting reclaim mode
> 
> The comment says, initially assume we are entering either lumpy reclaim or
> reclaim/compaction, and depending on the reclaim order, we will either set the
> sync mode or just reclaim order-0 pages later.
> 
> On other hand, order-0 reclaim, instead of sync reclaim, is expected when
> under memory pressure, but the check for memory pressure is incorrect,
> leading to sync reclaim at low reclaim priorities.
> 
> And the result is sync reclaim is set for high priorities.
> 

RECLAIM_MODE_SYNC is only set for RECLAIM_MODE_LUMPYRECLAIM. Even when
using RECLAIM_MODE_LUMPYRECLAIM, it should only be set when reclaim
is under memory pressure and failing to reclaim the necessry pages
(priority < DEF_PRIORITY - 2). Once in symc reclaim, reclaim will call
wait_on_page_writeback() on dirty pages which potentially leads to
significant stalls (one of the reasons why RECLAIM_MODE_LUMPYRECLAIM
sucks and why compaction is preferred). Your patch means sync reclaim
is used even when priority == DEF_PRIORITY. This is unexpected.

Your changelog really needs to explain what the problem is that you
have encountered and why this patch fixes it. It's not like some of
your other patches which were minor performance optimisations that
were self-evident.

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH] mm: vmscan: fix setting reclaim mode
  2012-01-10 16:44     ` Mel Gorman
@ 2012-01-10 16:58       ` Hillf Danton
  2012-01-11 12:12       ` Hillf Danton
  1 sibling, 0 replies; 6+ messages in thread
From: Hillf Danton @ 2012-01-10 16:58 UTC (permalink / raw)
  To: Mel Gorman
  Cc: linux-mm, KAMEZAWA Hiroyuki, David Rientjes, Andrew Morton, LKML

On Wed, Jan 11, 2012 at 12:44 AM, Mel Gorman <mgorman@suse.de> wrote:
> On Tue, Jan 10, 2012 at 11:58:03PM +0800, Hillf Danton wrote:
>> From: Hillf Danton <dhillf@gmail.com>
>> [PATCH] mm: vmscan: fix setting reclaim mode
>>
>> The comment says, initially assume we are entering either lumpy reclaim or
>> reclaim/compaction, and depending on the reclaim order, we will either set the
>> sync mode or just reclaim order-0 pages later.
>>
>> On other hand, order-0 reclaim, instead of sync reclaim, is expected when
>> under memory pressure, but the check for memory pressure is incorrect,
>> leading to sync reclaim at low reclaim priorities.
>>
>> And the result is sync reclaim is set for high priorities.
>>
>
> RECLAIM_MODE_SYNC is only set for RECLAIM_MODE_LUMPYRECLAIM. Even when
> using RECLAIM_MODE_LUMPYRECLAIM, it should only be set when reclaim
> is under memory pressure and failing to reclaim the necessry pages
> (priority < DEF_PRIORITY - 2). Once in symc reclaim, reclaim will call
> wait_on_page_writeback() on dirty pages which potentially leads to
> significant stalls (one of the reasons why RECLAIM_MODE_LUMPYRECLAIM
> sucks and why compaction is preferred). Your patch means sync reclaim
> is used even when priority == DEF_PRIORITY. This is unexpected.
>
> Your changelog really needs to explain what the problem is that you
> have encountered and why this patch fixes it. It's not like some of
> your other patches which were minor performance optimisations that
> were self-evident.
>
Hi Mel

To avoid another step in wrong direction, I'd goto bed now,
it is about 1:09 AM.
When sane again, I will try to understand your comment.

Best
Hillf

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

* Re: [PATCH] mm: vmscan: fix setting reclaim mode
  2012-01-10 16:44     ` Mel Gorman
  2012-01-10 16:58       ` Hillf Danton
@ 2012-01-11 12:12       ` Hillf Danton
  1 sibling, 0 replies; 6+ messages in thread
From: Hillf Danton @ 2012-01-11 12:12 UTC (permalink / raw)
  To: Mel Gorman
  Cc: linux-mm, KAMEZAWA Hiroyuki, David Rientjes, Andrew Morton, LKML

On Wed, Jan 11, 2012 at 12:44 AM, Mel Gorman <mgorman@suse.de> wrote:
> On Tue, Jan 10, 2012 at 11:58:03PM +0800, Hillf Danton wrote:
>> From: Hillf Danton <dhillf@gmail.com>
>> [PATCH] mm: vmscan: fix setting reclaim mode
>>
>> The comment says, initially assume we are entering either lumpy reclaim or
>> reclaim/compaction, and depending on the reclaim order, we will either set the
>> sync mode or just reclaim order-0 pages later.
>>
>> On other hand, order-0 reclaim, instead of sync reclaim, is expected when
>> under memory pressure, but the check for memory pressure is incorrect,
>> leading to sync reclaim at low reclaim priorities.
>>
>> And the result is sync reclaim is set for high priorities.
>>
>
> RECLAIM_MODE_SYNC is only set for RECLAIM_MODE_LUMPYRECLAIM. Even when
> using RECLAIM_MODE_LUMPYRECLAIM, it should only be set when reclaim
> is under memory pressure and failing to reclaim the necessry pages
> (priority < DEF_PRIORITY - 2). Once in symc reclaim, reclaim will call
> wait_on_page_writeback() on dirty pages which potentially leads to
> significant stalls (one of the reasons why RECLAIM_MODE_LUMPYRECLAIM
> sucks and why compaction is preferred). Your patch means sync reclaim
> is used even when priority == DEF_PRIORITY. This is unexpected.
>

Got and thanks for correcting Hillf

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

end of thread, other threads:[~2012-01-11 12:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-08  7:05 [PATCH] mm: vmscan: fix setting reclaim mode Hillf Danton
2012-01-10  9:44 ` Mel Gorman
2012-01-10 15:58   ` Hillf Danton
2012-01-10 16:44     ` Mel Gorman
2012-01-10 16:58       ` Hillf Danton
2012-01-11 12:12       ` 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).