diff options
author | David Rientjes <rientjes@google.com> | 2013-09-30 16:45:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-30 17:31:01 -0400 |
commit | f6ea3adb70b20ae36277a1b0eaaf4da9f6479a28 (patch) | |
tree | 9d21f9dfff81d06902db1bdd18d0bd575c06065c /mm | |
parent | 72023656961b8c81a168a7a6762d589339d0d7ec (diff) |
mm/compaction.c: periodically schedule when freeing pages
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>
Reviewed-by: Wanpeng Li <liwanp@linux.vnet.ibm.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/compaction.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index c43789388cd8..b5326b141a25 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -677,6 +677,13 @@ static void isolate_freepages(struct zone *zone, | |||
677 | pfn -= pageblock_nr_pages) { | 677 | pfn -= pageblock_nr_pages) { |
678 | unsigned long isolated; | 678 | unsigned long isolated; |
679 | 679 | ||
680 | /* | ||
681 | * This can iterate a massively long zone without finding any | ||
682 | * suitable migration targets, so periodically check if we need | ||
683 | * to schedule. | ||
684 | */ | ||
685 | cond_resched(); | ||
686 | |||
680 | if (!pfn_valid(pfn)) | 687 | if (!pfn_valid(pfn)) |
681 | continue; | 688 | continue; |
682 | 689 | ||