diff options
author | Minchan Kim <minchan@kernel.org> | 2012-07-31 19:43:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-07-31 21:42:42 -0400 |
commit | 80934513b230bfcf70265f2ef0fdae89fb391633 (patch) | |
tree | 9737d9b84b52312af968fe97f7c55fbf53617570 /mm | |
parent | 97d255c816946388bab504122937730d3447c612 (diff) |
mm: clean up __count_immobile_pages()
The __count_immobile_pages() naming is rather awkward. Choose a more
clear name and add a comment.
Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
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/page_alloc.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bb790f5919e3..fba2a1223f14 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -5471,26 +5471,28 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags, | |||
5471 | } | 5471 | } |
5472 | 5472 | ||
5473 | /* | 5473 | /* |
5474 | * This is designed as sub function...plz see page_isolation.c also. | 5474 | * This function checks whether pageblock includes unmovable pages or not. |
5475 | * set/clear page block's type to be ISOLATE. | 5475 | * If @count is not zero, it is okay to include less @count unmovable pages |
5476 | * page allocater never alloc memory from ISOLATE block. | 5476 | * |
5477 | * PageLRU check wihtout isolation or lru_lock could race so that | ||
5478 | * MIGRATE_MOVABLE block might include unmovable pages. It means you can't | ||
5479 | * expect this function should be exact. | ||
5477 | */ | 5480 | */ |
5478 | 5481 | static bool | |
5479 | static int | 5482 | __has_unmovable_pages(struct zone *zone, struct page *page, int count) |
5480 | __count_immobile_pages(struct zone *zone, struct page *page, int count) | ||
5481 | { | 5483 | { |
5482 | unsigned long pfn, iter, found; | 5484 | unsigned long pfn, iter, found; |
5483 | int mt; | 5485 | int mt; |
5484 | 5486 | ||
5485 | /* | 5487 | /* |
5486 | * For avoiding noise data, lru_add_drain_all() should be called | 5488 | * For avoiding noise data, lru_add_drain_all() should be called |
5487 | * If ZONE_MOVABLE, the zone never contains immobile pages | 5489 | * If ZONE_MOVABLE, the zone never contains unmovable pages |
5488 | */ | 5490 | */ |
5489 | if (zone_idx(zone) == ZONE_MOVABLE) | 5491 | if (zone_idx(zone) == ZONE_MOVABLE) |
5490 | return true; | 5492 | return false; |
5491 | mt = get_pageblock_migratetype(page); | 5493 | mt = get_pageblock_migratetype(page); |
5492 | if (mt == MIGRATE_MOVABLE || is_migrate_cma(mt)) | 5494 | if (mt == MIGRATE_MOVABLE || is_migrate_cma(mt)) |
5493 | return true; | 5495 | return false; |
5494 | 5496 | ||
5495 | pfn = page_to_pfn(page); | 5497 | pfn = page_to_pfn(page); |
5496 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { | 5498 | for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { |
@@ -5528,9 +5530,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count) | |||
5528 | * page at boot. | 5530 | * page at boot. |
5529 | */ | 5531 | */ |
5530 | if (found > count) | 5532 | if (found > count) |
5531 | return false; | 5533 | return true; |
5532 | } | 5534 | } |
5533 | return true; | 5535 | return false; |
5534 | } | 5536 | } |
5535 | 5537 | ||
5536 | bool is_pageblock_removable_nolock(struct page *page) | 5538 | bool is_pageblock_removable_nolock(struct page *page) |
@@ -5554,7 +5556,7 @@ bool is_pageblock_removable_nolock(struct page *page) | |||
5554 | zone->zone_start_pfn + zone->spanned_pages <= pfn) | 5556 | zone->zone_start_pfn + zone->spanned_pages <= pfn) |
5555 | return false; | 5557 | return false; |
5556 | 5558 | ||
5557 | return __count_immobile_pages(zone, page, 0); | 5559 | return !__has_unmovable_pages(zone, page, 0); |
5558 | } | 5560 | } |
5559 | 5561 | ||
5560 | int set_migratetype_isolate(struct page *page) | 5562 | int set_migratetype_isolate(struct page *page) |
@@ -5593,12 +5595,12 @@ int set_migratetype_isolate(struct page *page) | |||
5593 | * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. | 5595 | * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. |
5594 | * We just check MOVABLE pages. | 5596 | * We just check MOVABLE pages. |
5595 | */ | 5597 | */ |
5596 | if (__count_immobile_pages(zone, page, arg.pages_found)) | 5598 | if (!__has_unmovable_pages(zone, page, arg.pages_found)) |
5597 | ret = 0; | 5599 | ret = 0; |
5598 | |||
5599 | /* | 5600 | /* |
5600 | * immobile means "not-on-lru" paes. If immobile is larger than | 5601 | * Unmovable means "not-on-lru" pages. If Unmovable pages are |
5601 | * removable-by-driver pages reported by notifier, we'll fail. | 5602 | * larger than removable-by-driver pages reported by notifier, |
5603 | * we'll fail. | ||
5602 | */ | 5604 | */ |
5603 | 5605 | ||
5604 | out: | 5606 | out: |