All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages
@ 2017-01-13 11:51 Lucas Stach
  2017-01-13 12:19 ` Michal Hocko
  2017-01-13 13:24 ` Vlastimil Babka
  0 siblings, 2 replies; 5+ messages in thread
From: Lucas Stach @ 2017-01-13 11:51 UTC (permalink / raw)
  To: Andrew Morton, Michal Hocko
  Cc: Joonsoo Kim, Vlastimil Babka, Mel Gorman, linux-mm, kernel,
	patchwork-lst

Commit 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
changed compation to skip FS pages if not explicitly allowed to touch them,
but missed to update the CMA compact_control.

This leads to a very high isolation failure rate, crippling performance of
CMA even on a lightly loaded system. Re-allow CMA to compact FS pages by
setting the correct GFP flags, restoring CMA behavior and performance to
the kernel 4.9 level.

Fixes: 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 mm/page_alloc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8d5d82c8a85a..eced9fee582b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7255,6 +7255,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
 		.zone = page_zone(pfn_to_page(start)),
 		.mode = MIGRATE_SYNC,
 		.ignore_skip_hint = true,
+		.gfp_mask = GFP_KERNEL,
 	};
 	INIT_LIST_HEAD(&cc.migratepages);
 
-- 
2.11.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages
  2017-01-13 11:51 [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages Lucas Stach
@ 2017-01-13 12:19 ` Michal Hocko
  2017-01-13 13:24 ` Vlastimil Babka
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2017-01-13 12:19 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Andrew Morton, Joonsoo Kim, Vlastimil Babka, Mel Gorman,
	linux-mm, kernel, patchwork-lst

On Fri 13-01-17 12:51:55, Lucas Stach wrote:
> Commit 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> changed compation to skip FS pages if not explicitly allowed to touch them,
> but missed to update the CMA compact_control.
> 
> This leads to a very high isolation failure rate, crippling performance of
> CMA even on a lightly loaded system. Re-allow CMA to compact FS pages by
> setting the correct GFP flags, restoring CMA behavior and performance to
> the kernel 4.9 level.
> 
> Fixes: 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks for catching that.

> ---
>  mm/page_alloc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 8d5d82c8a85a..eced9fee582b 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7255,6 +7255,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
>  		.zone = page_zone(pfn_to_page(start)),
>  		.mode = MIGRATE_SYNC,
>  		.ignore_skip_hint = true,
> +		.gfp_mask = GFP_KERNEL,
>  	};
>  	INIT_LIST_HEAD(&cc.migratepages);
>  
> -- 
> 2.11.0
> 

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages
  2017-01-13 11:51 [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages Lucas Stach
  2017-01-13 12:19 ` Michal Hocko
@ 2017-01-13 13:24 ` Vlastimil Babka
  2017-01-13 13:35   ` Lucas Stach
  1 sibling, 1 reply; 5+ messages in thread
From: Vlastimil Babka @ 2017-01-13 13:24 UTC (permalink / raw)
  To: Lucas Stach, Andrew Morton, Michal Hocko
  Cc: Joonsoo Kim, Mel Gorman, linux-mm, kernel, patchwork-lst

On 01/13/2017 12:51 PM, Lucas Stach wrote:
> Commit 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> changed compation to skip FS pages if not explicitly allowed to touch them,
> but missed to update the CMA compact_control.
>
> This leads to a very high isolation failure rate, crippling performance of
> CMA even on a lightly loaded system. Re-allow CMA to compact FS pages by
> setting the correct GFP flags, restoring CMA behavior and performance to
> the kernel 4.9 level.
>
> Fixes: 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Acked-by: Vlastimil Babka <vbabka@suse.cz>

It's true that this restores the behavior for CMA to 4.9. But it also reveals 
that CMA always implicitly assumed to be called from non-fs context. That's 
expectable for the original CMA use-case of drivers for devices such as cameras, 
but I now wonder if there's danger when CMA gets invoked via dma-cma layer with 
generic cma range for e.g. a disk device... I guess that would be another 
argument for scoped GFP_NOFS, which should then be applied to adjust the 
gfp_mask here. Or we could apply at least memalloc_noio_flags() right now, which 
should already handle the disk device -> dma -> cma scenario?

> ---
>  mm/page_alloc.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 8d5d82c8a85a..eced9fee582b 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -7255,6 +7255,7 @@ int alloc_contig_range(unsigned long start, unsigned long end,
>  		.zone = page_zone(pfn_to_page(start)),
>  		.mode = MIGRATE_SYNC,
>  		.ignore_skip_hint = true,
> +		.gfp_mask = GFP_KERNEL,
>  	};
>  	INIT_LIST_HEAD(&cc.migratepages);
>
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages
  2017-01-13 13:24 ` Vlastimil Babka
@ 2017-01-13 13:35   ` Lucas Stach
  2017-01-13 13:47     ` Michal Hocko
  0 siblings, 1 reply; 5+ messages in thread
From: Lucas Stach @ 2017-01-13 13:35 UTC (permalink / raw)
  To: Vlastimil Babka
  Cc: Andrew Morton, Michal Hocko, Joonsoo Kim, Mel Gorman, linux-mm,
	kernel, patchwork-lst

Am Freitag, den 13.01.2017, 14:24 +0100 schrieb Vlastimil Babka:
> On 01/13/2017 12:51 PM, Lucas Stach wrote:
> > Commit 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> > changed compation to skip FS pages if not explicitly allowed to touch them,
> > but missed to update the CMA compact_control.
> >
> > This leads to a very high isolation failure rate, crippling performance of
> > CMA even on a lightly loaded system. Re-allow CMA to compact FS pages by
> > setting the correct GFP flags, restoring CMA behavior and performance to
> > the kernel 4.9 level.
> >
> > Fixes: 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> 
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
> 
> It's true that this restores the behavior for CMA to 4.9. But it also reveals 
> that CMA always implicitly assumed to be called from non-fs context. That's 
> expectable for the original CMA use-case of drivers for devices such as cameras, 
> but I now wonder if there's danger when CMA gets invoked via dma-cma layer with 
> generic cma range for e.g. a disk device... I guess that would be another 
> argument for scoped GFP_NOFS, which should then be applied to adjust the 
> gfp_mask here. Or we could apply at least memalloc_noio_flags() right now, which 
> should already handle the disk device -> dma -> cma scenario?

That's right. But I don't think we need to fix this for 4.10. The
minimal fix in this patch brings things back to the old assumptions.

As dma allocations already carry proper GFP flags it's just a matter of
passing them through to CMA, to make things work correctly. I'll cook up
a follow up patch for that, but I think this should wait for the next
merge window to be applied.

Regards,
Lucas

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages
  2017-01-13 13:35   ` Lucas Stach
@ 2017-01-13 13:47     ` Michal Hocko
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2017-01-13 13:47 UTC (permalink / raw)
  To: Lucas Stach
  Cc: Vlastimil Babka, Andrew Morton, Joonsoo Kim, Mel Gorman,
	linux-mm, kernel, patchwork-lst

On Fri 13-01-17 14:35:10, Lucas Stach wrote:
> Am Freitag, den 13.01.2017, 14:24 +0100 schrieb Vlastimil Babka:
> > On 01/13/2017 12:51 PM, Lucas Stach wrote:
> > > Commit 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> > > changed compation to skip FS pages if not explicitly allowed to touch them,
> > > but missed to update the CMA compact_control.
> > >
> > > This leads to a very high isolation failure rate, crippling performance of
> > > CMA even on a lightly loaded system. Re-allow CMA to compact FS pages by
> > > setting the correct GFP flags, restoring CMA behavior and performance to
> > > the kernel 4.9 level.
> > >
> > > Fixes: 73e64c51afc5 (mm, compaction: allow compaction for GFP_NOFS requests)
> > > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > 
> > Acked-by: Vlastimil Babka <vbabka@suse.cz>
> > 
> > It's true that this restores the behavior for CMA to 4.9. But it also reveals 
> > that CMA always implicitly assumed to be called from non-fs context. That's 
> > expectable for the original CMA use-case of drivers for devices such as cameras, 
> > but I now wonder if there's danger when CMA gets invoked via dma-cma layer with 
> > generic cma range for e.g. a disk device... I guess that would be another 
> > argument for scoped GFP_NOFS, which should then be applied to adjust the 
> > gfp_mask here. Or we could apply at least memalloc_noio_flags() right now, which 
> > should already handle the disk device -> dma -> cma scenario?
> 
> That's right. But I don't think we need to fix this for 4.10. The
> minimal fix in this patch brings things back to the old assumptions.
> 
> As dma allocations already carry proper GFP flags it's just a matter of
> passing them through to CMA, to make things work correctly. I'll cook up
> a follow up patch for that, but I think this should wait for the next
> merge window to be applied.

Agreed. Thanks!
-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2017-01-13 13:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13 11:51 [PATCH] mm: alloc_contig: re-allow CMA to compact FS pages Lucas Stach
2017-01-13 12:19 ` Michal Hocko
2017-01-13 13:24 ` Vlastimil Babka
2017-01-13 13:35   ` Lucas Stach
2017-01-13 13:47     ` Michal Hocko

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.