linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch] mm, compaction: periodically schedule when freeing pages
@ 2013-09-04 23:25 David Rientjes
  2013-09-04 23:58 ` Rik van Riel
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: David Rientjes @ 2013-09-04 23:25 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Mel Gorman, Rik van Riel, Minchan Kim, linux-kernel, linux-mm

We've been getting warnings about an excessive amount of time spent
allocating pages for migration during memory compaction without
scheduling.  isolate_freepages_block() already periodically checks for
contended locks or the need to schedule, but isolate_freepages() never
does.

When a zone is massively long and no suitable targets can be found, this
iteration can be quite expensive without ever doing cond_resched().

Check periodically for the need to reschedule while the compaction free
scanner iterates.

Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/compaction.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/compaction.c b/mm/compaction.c
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -677,6 +677,13 @@ static void isolate_freepages(struct zone *zone,
 					pfn -= pageblock_nr_pages) {
 		unsigned long isolated;
 
+		/*
+		 * This can iterate a massively long zone without finding any
+		 * suitable migration targets, so periodically check if we need
+		 * to schedule.
+		 */
+		cond_resched();
+
 		if (!pfn_valid(pfn))
 			continue;
 

--
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, compaction: periodically schedule when freeing pages
  2013-09-04 23:25 [patch] mm, compaction: periodically schedule when freeing pages David Rientjes
@ 2013-09-04 23:58 ` Rik van Riel
  2013-09-05  0:50 ` Wanpeng Li
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Rik van Riel @ 2013-09-04 23:58 UTC (permalink / raw)
  To: David Rientjes
  Cc: Andrew Morton, Mel Gorman, Minchan Kim, linux-kernel, linux-mm

On 09/04/2013 07:25 PM, David Rientjes wrote:
> We've been getting warnings about an excessive amount of time spent
> allocating pages for migration during memory compaction without
> scheduling.  isolate_freepages_block() already periodically checks for
> contended locks or the need to schedule, but isolate_freepages() never
> does.
> 
> When a zone is massively long and no suitable targets can be found, this
> iteration can be quite expensive without ever doing cond_resched().
> 
> Check periodically for the need to reschedule while the compaction free
> scanner iterates.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>

Reviewed-by: Rik van Riel <riel@redhat.com>

-- 
All rights reversed

--
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, compaction: periodically schedule when freeing pages
  2013-09-04 23:25 [patch] mm, compaction: periodically schedule when freeing pages David Rientjes
  2013-09-04 23:58 ` Rik van Riel
@ 2013-09-05  0:50 ` Wanpeng Li
  2013-09-05  0:50 ` Wanpeng Li
  2013-09-10 13:20 ` Mel Gorman
  3 siblings, 0 replies; 5+ messages in thread
From: Wanpeng Li @ 2013-09-05  0:50 UTC (permalink / raw)
  To: David Rientjes
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Minchan Kim,
	linux-kernel, linux-mm

On Wed, Sep 04, 2013 at 04:25:59PM -0700, David Rientjes wrote:
>We've been getting warnings about an excessive amount of time spent
>allocating pages for migration during memory compaction without
>scheduling.  isolate_freepages_block() already periodically checks for
>contended locks or the need to schedule, but isolate_freepages() never
>does.
>
>When a zone is massively long and no suitable targets can be found, this
>iteration can be quite expensive without ever doing cond_resched().
>
>Check periodically for the need to reschedule while the compaction free
>scanner iterates.
>

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

>Signed-off-by: David Rientjes <rientjes@google.com>
>---
> mm/compaction.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/mm/compaction.c b/mm/compaction.c
>--- a/mm/compaction.c
>+++ b/mm/compaction.c
>@@ -677,6 +677,13 @@ static void isolate_freepages(struct zone *zone,
> 					pfn -= pageblock_nr_pages) {
> 		unsigned long isolated;
>
>+		/*
>+		 * This can iterate a massively long zone without finding any
>+		 * suitable migration targets, so periodically check if we need
>+		 * to schedule.
>+		 */
>+		cond_resched();
>+
> 		if (!pfn_valid(pfn))
> 			continue;
>
>
>--
>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>

--
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, compaction: periodically schedule when freeing pages
  2013-09-04 23:25 [patch] mm, compaction: periodically schedule when freeing pages David Rientjes
  2013-09-04 23:58 ` Rik van Riel
  2013-09-05  0:50 ` Wanpeng Li
@ 2013-09-05  0:50 ` Wanpeng Li
  2013-09-10 13:20 ` Mel Gorman
  3 siblings, 0 replies; 5+ messages in thread
From: Wanpeng Li @ 2013-09-05  0:50 UTC (permalink / raw)
  To: David Rientjes
  Cc: Andrew Morton, Mel Gorman, Rik van Riel, Minchan Kim,
	linux-kernel, linux-mm

On Wed, Sep 04, 2013 at 04:25:59PM -0700, David Rientjes wrote:
>We've been getting warnings about an excessive amount of time spent
>allocating pages for migration during memory compaction without
>scheduling.  isolate_freepages_block() already periodically checks for
>contended locks or the need to schedule, but isolate_freepages() never
>does.
>
>When a zone is massively long and no suitable targets can be found, this
>iteration can be quite expensive without ever doing cond_resched().
>
>Check periodically for the need to reschedule while the compaction free
>scanner iterates.
>

Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>

>Signed-off-by: David Rientjes <rientjes@google.com>
>---
> mm/compaction.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/mm/compaction.c b/mm/compaction.c
>--- a/mm/compaction.c
>+++ b/mm/compaction.c
>@@ -677,6 +677,13 @@ static void isolate_freepages(struct zone *zone,
> 					pfn -= pageblock_nr_pages) {
> 		unsigned long isolated;
>
>+		/*
>+		 * This can iterate a massively long zone without finding any
>+		 * suitable migration targets, so periodically check if we need
>+		 * to schedule.
>+		 */
>+		cond_resched();
>+
> 		if (!pfn_valid(pfn))
> 			continue;
>
>
>--
>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>

--
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, compaction: periodically schedule when freeing pages
  2013-09-04 23:25 [patch] mm, compaction: periodically schedule when freeing pages David Rientjes
                   ` (2 preceding siblings ...)
  2013-09-05  0:50 ` Wanpeng Li
@ 2013-09-10 13:20 ` Mel Gorman
  3 siblings, 0 replies; 5+ messages in thread
From: Mel Gorman @ 2013-09-10 13:20 UTC (permalink / raw)
  To: David Rientjes
  Cc: Andrew Morton, Rik van Riel, Minchan Kim, linux-kernel, linux-mm

On Wed, Sep 04, 2013 at 04:25:59PM -0700, David Rientjes wrote:
> We've been getting warnings about an excessive amount of time spent
> allocating pages for migration during memory compaction without
> scheduling.  isolate_freepages_block() already periodically checks for
> contended locks or the need to schedule, but isolate_freepages() never
> does.
> 
> When a zone is massively long and no suitable targets can be found, this
> iteration can be quite expensive without ever doing cond_resched().
> 
> Check periodically for the need to reschedule while the compaction free
> scanner iterates.
> 
> Signed-off-by: David Rientjes <rientjes@google.com>

Ok, fair enough.

Acked-by: Mel Gorman <mgorman@suse.de>

However I'm curious. Do you know why the combined use of
compact_cached_free_pfn and pageblock skip bits is not enough for the scanner
to quickly find a pageblock that is suitable for isolate_freepages_block()?
Is the pageblock skip information getting cleared frequently by kswapd
or something?

-- 
Mel Gorman
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:[~2013-09-10 13:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-04 23:25 [patch] mm, compaction: periodically schedule when freeing pages David Rientjes
2013-09-04 23:58 ` Rik van Riel
2013-09-05  0:50 ` Wanpeng Li
2013-09-05  0:50 ` Wanpeng Li
2013-09-10 13:20 ` Mel Gorman

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