linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: __rmqueue_fallback() should respect pageblock type
@ 2013-10-31  4:24 kosaki.motohiro
  2013-10-31  4:35 ` Andrew Morton
  2013-10-31  5:15 ` KOSAKI Motohiro
  0 siblings, 2 replies; 4+ messages in thread
From: kosaki.motohiro @ 2013-10-31  4:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, akpm, KOSAKI Motohiro, Mel Gorman

From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

When __rmqueue_fallback() don't find out a free block with the same size
of required, it splits a larger page and puts back rest peiece of the page
to free list.

But it has one serious mistake. When putting back, __rmqueue_fallback()
always use start_migratetype if type is not CMA. However, __rmqueue_fallback()
is only called when all of start_migratetype queue are empty. That said,
__rmqueue_fallback always put back memory to wrong queue except
try_to_steal_freepages() changed pageblock type (i.e. requested size is
smaller than half of page block). Finally, antifragmentation framework
increase fragmenation instead of decrease.

Mel's original anti fragmentation do the right thing. But commit 47118af076
(mm: mmzone: MIGRATE_CMA migration type added) broke it.

This patch restores sane and old behavior.

Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
 mm/page_alloc.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index dd886fa..ea7bb9a 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1101,7 +1101,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype)
 			 */
 			expand(zone, page, order, current_order, area,
 			       is_migrate_cma(migratetype)
-			     ? migratetype : start_migratetype);
+			     ? migratetype : new_type);
 
 			trace_mm_page_alloc_extfrag(page, order,
 				current_order, start_migratetype, migratetype,
-- 
1.7.1


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

* Re: [PATCH] mm: __rmqueue_fallback() should respect pageblock type
  2013-10-31  4:24 [PATCH] mm: __rmqueue_fallback() should respect pageblock type kosaki.motohiro
@ 2013-10-31  4:35 ` Andrew Morton
  2013-10-31  5:00   ` KOSAKI Motohiro
  2013-10-31  5:15 ` KOSAKI Motohiro
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2013-10-31  4:35 UTC (permalink / raw)
  To: kosaki.motohiro; +Cc: linux-kernel, linux-mm, KOSAKI Motohiro, Mel Gorman

On Thu, 31 Oct 2013 00:24:49 -0400 kosaki.motohiro@gmail.com wrote:

> When __rmqueue_fallback() don't find out a free block with the same size
> of required, it splits a larger page and puts back rest peiece of the page
> to free list.
> 
> But it has one serious mistake. When putting back, __rmqueue_fallback()
> always use start_migratetype if type is not CMA. However, __rmqueue_fallback()
> is only called when all of start_migratetype queue are empty. That said,
> __rmqueue_fallback always put back memory to wrong queue except
> try_to_steal_freepages() changed pageblock type (i.e. requested size is
> smaller than half of page block). Finally, antifragmentation framework
> increase fragmenation instead of decrease.
> 
> Mel's original anti fragmentation do the right thing. But commit 47118af076
> (mm: mmzone: MIGRATE_CMA migration type added) broke it.
> 
> This patch restores sane and old behavior.

What are the user-visible runtime effects of this change?

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

* Re: [PATCH] mm: __rmqueue_fallback() should respect pageblock type
  2013-10-31  4:35 ` Andrew Morton
@ 2013-10-31  5:00   ` KOSAKI Motohiro
  0 siblings, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2013-10-31  5:00 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kosaki.motohiro, linux-kernel, linux-mm, KOSAKI Motohiro, Mel Gorman

(10/31/13 12:35 AM), Andrew Morton wrote:
> On Thu, 31 Oct 2013 00:24:49 -0400 kosaki.motohiro@gmail.com wrote:
>
>> When __rmqueue_fallback() don't find out a free block with the same size
>> of required, it splits a larger page and puts back rest peiece of the page
>> to free list.
>>
>> But it has one serious mistake. When putting back, __rmqueue_fallback()
>> always use start_migratetype if type is not CMA. However, __rmqueue_fallback()
>> is only called when all of start_migratetype queue are empty. That said,
>> __rmqueue_fallback always put back memory to wrong queue except
>> try_to_steal_freepages() changed pageblock type (i.e. requested size is
>> smaller than half of page block). Finally, antifragmentation framework
>> increase fragmenation instead of decrease.
>>
>> Mel's original anti fragmentation do the right thing. But commit 47118af076
>> (mm: mmzone: MIGRATE_CMA migration type added) broke it.
>>
>> This patch restores sane and old behavior.
>
> What are the user-visible runtime effects of this change?

Memory fragmentation may increase compaction rate. (And then system get unnecessary
slow down)



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

* Re: [PATCH] mm: __rmqueue_fallback() should respect pageblock type
  2013-10-31  4:24 [PATCH] mm: __rmqueue_fallback() should respect pageblock type kosaki.motohiro
  2013-10-31  4:35 ` Andrew Morton
@ 2013-10-31  5:15 ` KOSAKI Motohiro
  1 sibling, 0 replies; 4+ messages in thread
From: KOSAKI Motohiro @ 2013-10-31  5:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, akpm, KOSAKI Motohiro, Mel Gorman

(10/31/13 12:24 AM), kosaki.motohiro@gmail.com wrote:
> From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> 
> When __rmqueue_fallback() don't find out a free block with the same size
> of required, it splits a larger page and puts back rest peiece of the page
> to free list.
> 
> But it has one serious mistake. When putting back, __rmqueue_fallback()
> always use start_migratetype if type is not CMA. However, __rmqueue_fallback()
> is only called when all of start_migratetype queue are empty. That said,
> __rmqueue_fallback always put back memory to wrong queue except
> try_to_steal_freepages() changed pageblock type (i.e. requested size is
> smaller than half of page block). Finally, antifragmentation framework
> increase fragmenation instead of decrease.
> 
> Mel's original anti fragmentation do the right thing. But commit 47118af076
> (mm: mmzone: MIGRATE_CMA migration type added) broke it.
> 
> This patch restores sane and old behavior.
> 
> Cc: Mel Gorman <mgorman@suse.de>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
>   mm/page_alloc.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index dd886fa..ea7bb9a 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1101,7 +1101,7 @@ __rmqueue_fallback(struct zone *zone, int order, int start_migratetype)
>   			 */
>   			expand(zone, page, order, current_order, area,
>   			       is_migrate_cma(migratetype)
> -			     ? migratetype : start_migratetype);
> +			     ? migratetype : new_type);

Oops, this can be simplified to following because try_to_steal_freepages() has cma check.


-                       expand(zone, page, order, current_order, area,
-                              is_migrate_cma(migratetype)
-                            ? migratetype : start_migratetype);
+                       expand(zone, page, order, current_order, area, new_type);




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

end of thread, other threads:[~2013-10-31  5:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-31  4:24 [PATCH] mm: __rmqueue_fallback() should respect pageblock type kosaki.motohiro
2013-10-31  4:35 ` Andrew Morton
2013-10-31  5:00   ` KOSAKI Motohiro
2013-10-31  5:15 ` KOSAKI Motohiro

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).