diff options
Diffstat (limited to 'mm/compaction.c')
-rw-r--r-- | mm/compaction.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 6cc604bd5649..899d95638586 100644 --- a/mm/compaction.c +++ b/mm/compaction.c | |||
@@ -35,10 +35,6 @@ struct compact_control { | |||
35 | unsigned long migrate_pfn; /* isolate_migratepages search base */ | 35 | unsigned long migrate_pfn; /* isolate_migratepages search base */ |
36 | bool sync; /* Synchronous migration */ | 36 | bool sync; /* Synchronous migration */ |
37 | 37 | ||
38 | /* Account for isolated anon and file pages */ | ||
39 | unsigned long nr_anon; | ||
40 | unsigned long nr_file; | ||
41 | |||
42 | unsigned int order; /* order a direct compactor needs */ | 38 | unsigned int order; /* order a direct compactor needs */ |
43 | int migratetype; /* MOVABLE, RECLAIMABLE etc */ | 39 | int migratetype; /* MOVABLE, RECLAIMABLE etc */ |
44 | struct zone *zone; | 40 | struct zone *zone; |
@@ -223,17 +219,13 @@ static void isolate_freepages(struct zone *zone, | |||
223 | static void acct_isolated(struct zone *zone, struct compact_control *cc) | 219 | static void acct_isolated(struct zone *zone, struct compact_control *cc) |
224 | { | 220 | { |
225 | struct page *page; | 221 | struct page *page; |
226 | unsigned int count[NR_LRU_LISTS] = { 0, }; | 222 | unsigned int count[2] = { 0, }; |
227 | 223 | ||
228 | list_for_each_entry(page, &cc->migratepages, lru) { | 224 | list_for_each_entry(page, &cc->migratepages, lru) |
229 | int lru = page_lru_base_type(page); | 225 | count[!!page_is_file_cache(page)]++; |
230 | count[lru]++; | ||
231 | } | ||
232 | 226 | ||
233 | cc->nr_anon = count[LRU_ACTIVE_ANON] + count[LRU_INACTIVE_ANON]; | 227 | __mod_zone_page_state(zone, NR_ISOLATED_ANON, count[0]); |
234 | cc->nr_file = count[LRU_ACTIVE_FILE] + count[LRU_INACTIVE_FILE]; | 228 | __mod_zone_page_state(zone, NR_ISOLATED_FILE, count[1]); |
235 | __mod_zone_page_state(zone, NR_ISOLATED_ANON, cc->nr_anon); | ||
236 | __mod_zone_page_state(zone, NR_ISOLATED_FILE, cc->nr_file); | ||
237 | } | 229 | } |
238 | 230 | ||
239 | /* Similar to reclaim, but different enough that they don't share logic */ | 231 | /* Similar to reclaim, but different enough that they don't share logic */ |
@@ -269,6 +261,7 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, | |||
269 | unsigned long last_pageblock_nr = 0, pageblock_nr; | 261 | unsigned long last_pageblock_nr = 0, pageblock_nr; |
270 | unsigned long nr_scanned = 0, nr_isolated = 0; | 262 | unsigned long nr_scanned = 0, nr_isolated = 0; |
271 | struct list_head *migratelist = &cc->migratepages; | 263 | struct list_head *migratelist = &cc->migratepages; |
264 | isolate_mode_t mode = ISOLATE_ACTIVE|ISOLATE_INACTIVE; | ||
272 | 265 | ||
273 | /* Do not scan outside zone boundaries */ | 266 | /* Do not scan outside zone boundaries */ |
274 | low_pfn = max(cc->migrate_pfn, zone->zone_start_pfn); | 267 | low_pfn = max(cc->migrate_pfn, zone->zone_start_pfn); |
@@ -356,8 +349,11 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, | |||
356 | continue; | 349 | continue; |
357 | } | 350 | } |
358 | 351 | ||
352 | if (!cc->sync) | ||
353 | mode |= ISOLATE_CLEAN; | ||
354 | |||
359 | /* Try isolate the page */ | 355 | /* Try isolate the page */ |
360 | if (__isolate_lru_page(page, ISOLATE_BOTH, 0) != 0) | 356 | if (__isolate_lru_page(page, mode, 0) != 0) |
361 | continue; | 357 | continue; |
362 | 358 | ||
363 | VM_BUG_ON(PageTransCompound(page)); | 359 | VM_BUG_ON(PageTransCompound(page)); |
@@ -586,7 +582,7 @@ out: | |||
586 | return ret; | 582 | return ret; |
587 | } | 583 | } |
588 | 584 | ||
589 | unsigned long compact_zone_order(struct zone *zone, | 585 | static unsigned long compact_zone_order(struct zone *zone, |
590 | int order, gfp_t gfp_mask, | 586 | int order, gfp_t gfp_mask, |
591 | bool sync) | 587 | bool sync) |
592 | { | 588 | { |