Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Minchan Kim and committed by
Linus Torvalds
80934513 97d255c8

+18 -16
+18 -16
mm/page_alloc.c
··· 5471 5471 } 5472 5472 5473 5473 /* 5474 - * This is designed as sub function...plz see page_isolation.c also. 5475 - * set/clear page block's type to be ISOLATE. 5476 - * page allocater never alloc memory from ISOLATE block. 5474 + * This function checks whether pageblock includes unmovable pages or not. 5475 + * If @count is not zero, it is okay to include less @count unmovable pages 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 - 5479 - static int 5480 - __count_immobile_pages(struct zone *zone, struct page *page, int count) 5481 + static bool 5482 + __has_unmovable_pages(struct zone *zone, struct page *page, int count) 5481 5483 { 5482 5484 unsigned long pfn, iter, found; 5483 5485 int mt; 5484 5486 5485 5487 /* 5486 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 5491 if (zone_idx(zone) == ZONE_MOVABLE) 5490 - return true; 5492 + return false; 5491 5493 mt = get_pageblock_migratetype(page); 5492 5494 if (mt == MIGRATE_MOVABLE || is_migrate_cma(mt)) 5493 - return true; 5495 + return false; 5494 5496 5495 5497 pfn = page_to_pfn(page); 5496 5498 for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { ··· 5530 5528 * page at boot. 5531 5529 */ 5532 5530 if (found > count) 5533 - return false; 5531 + return true; 5534 5532 } 5535 - return true; 5533 + return false; 5536 5534 } 5537 5535 5538 5536 bool is_pageblock_removable_nolock(struct page *page) ··· 5556 5554 zone->zone_start_pfn + zone->spanned_pages <= pfn) 5557 5555 return false; 5558 5556 5559 - return __count_immobile_pages(zone, page, 0); 5557 + return !__has_unmovable_pages(zone, page, 0); 5560 5558 } 5561 5559 5562 5560 int set_migratetype_isolate(struct page *page) ··· 5595 5593 * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. 5596 5594 * We just check MOVABLE pages. 5597 5595 */ 5598 - if (__count_immobile_pages(zone, page, arg.pages_found)) 5596 + if (!__has_unmovable_pages(zone, page, arg.pages_found)) 5599 5597 ret = 0; 5600 - 5601 5598 /* 5602 - * immobile means "not-on-lru" paes. If immobile is larger than 5603 - * removable-by-driver pages reported by notifier, we'll fail. 5599 + * Unmovable means "not-on-lru" pages. If Unmovable pages are 5600 + * larger than removable-by-driver pages reported by notifier, 5601 + * we'll fail. 5604 5602 */ 5605 5603 5606 5604 out: