diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/compaction.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 4954e196680c..782772df62c8 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -490,6 +490,13 @@ static unsigned long isolate_freepages_block(struct compact_control *cc, | |||
490 | 490 | ||
491 | /* If a page was split, advance to the end of it */ | 491 | /* If a page was split, advance to the end of it */ |
492 | if (isolated) { | 492 | if (isolated) { |
493 | cc->nr_freepages += isolated; | ||
494 | if (!strict && | ||
495 | cc->nr_migratepages <= cc->nr_freepages) { | ||
496 | blockpfn += isolated; | ||
497 | break; | ||
498 | } | ||
499 | |||
493 | blockpfn += isolated - 1; | 500 | blockpfn += isolated - 1; |
494 | cursor += isolated - 1; | 501 | cursor += isolated - 1; |
495 | continue; | 502 | continue; |
@@ -899,7 +906,6 @@ static void isolate_freepages(struct compact_control *cc) | |||
899 | unsigned long isolate_start_pfn; /* exact pfn we start at */ | 906 | unsigned long isolate_start_pfn; /* exact pfn we start at */ |
900 | unsigned long block_end_pfn; /* end of current pageblock */ | 907 | unsigned long block_end_pfn; /* end of current pageblock */ |
901 | unsigned long low_pfn; /* lowest pfn scanner is able to scan */ | 908 | unsigned long low_pfn; /* lowest pfn scanner is able to scan */ |
902 | int nr_freepages = cc->nr_freepages; | ||
903 | struct list_head *freelist = &cc->freepages; | 909 | struct list_head *freelist = &cc->freepages; |
904 | 910 | ||
905 | /* | 911 | /* |
@@ -924,11 +930,11 @@ static void isolate_freepages(struct compact_control *cc) | |||
924 | * pages on cc->migratepages. We stop searching if the migrate | 930 | * pages on cc->migratepages. We stop searching if the migrate |
925 | * and free page scanners meet or enough free pages are isolated. | 931 | * and free page scanners meet or enough free pages are isolated. |
926 | */ | 932 | */ |
927 | for (; block_start_pfn >= low_pfn && cc->nr_migratepages > nr_freepages; | 933 | for (; block_start_pfn >= low_pfn && |
934 | cc->nr_migratepages > cc->nr_freepages; | ||
928 | block_end_pfn = block_start_pfn, | 935 | block_end_pfn = block_start_pfn, |
929 | block_start_pfn -= pageblock_nr_pages, | 936 | block_start_pfn -= pageblock_nr_pages, |
930 | isolate_start_pfn = block_start_pfn) { | 937 | isolate_start_pfn = block_start_pfn) { |
931 | unsigned long isolated; | ||
932 | 938 | ||
933 | /* | 939 | /* |
934 | * This can iterate a massively long zone without finding any | 940 | * This can iterate a massively long zone without finding any |
@@ -953,9 +959,8 @@ static void isolate_freepages(struct compact_control *cc) | |||
953 | continue; | 959 | continue; |
954 | 960 | ||
955 | /* Found a block suitable for isolating free pages from. */ | 961 | /* Found a block suitable for isolating free pages from. */ |
956 | isolated = isolate_freepages_block(cc, &isolate_start_pfn, | 962 | isolate_freepages_block(cc, &isolate_start_pfn, |
957 | block_end_pfn, freelist, false); | 963 | block_end_pfn, freelist, false); |
958 | nr_freepages += isolated; | ||
959 | 964 | ||
960 | /* | 965 | /* |
961 | * Remember where the free scanner should restart next time, | 966 | * Remember where the free scanner should restart next time, |
@@ -987,8 +992,6 @@ static void isolate_freepages(struct compact_control *cc) | |||
987 | */ | 992 | */ |
988 | if (block_start_pfn < low_pfn) | 993 | if (block_start_pfn < low_pfn) |
989 | cc->free_pfn = cc->migrate_pfn; | 994 | cc->free_pfn = cc->migrate_pfn; |
990 | |||
991 | cc->nr_freepages = nr_freepages; | ||
992 | } | 995 | } |
993 | 996 | ||
994 | /* | 997 | /* |