Commit 80934513 authored by Minchan Kim's avatar Minchan Kim Committed by Linus Torvalds

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: default avatarMinchan Kim <minchan@kernel.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Michal Hocko <mhocko@suse.cz>
Acked-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 97d255c8
...@@ -5471,26 +5471,28 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags, ...@@ -5471,26 +5471,28 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
} }
/* /*
* This is designed as sub function...plz see page_isolation.c also. * This function checks whether pageblock includes unmovable pages or not.
* set/clear page block's type to be ISOLATE. * If @count is not zero, it is okay to include less @count unmovable pages
* page allocater never alloc memory from ISOLATE block. *
* PageLRU check wihtout isolation or lru_lock could race so that
* MIGRATE_MOVABLE block might include unmovable pages. It means you can't
* expect this function should be exact.
*/ */
static bool
static int __has_unmovable_pages(struct zone *zone, struct page *page, int count)
__count_immobile_pages(struct zone *zone, struct page *page, int count)
{ {
unsigned long pfn, iter, found; unsigned long pfn, iter, found;
int mt; int mt;
/* /*
* For avoiding noise data, lru_add_drain_all() should be called * For avoiding noise data, lru_add_drain_all() should be called
* If ZONE_MOVABLE, the zone never contains immobile pages * If ZONE_MOVABLE, the zone never contains unmovable pages
*/ */
if (zone_idx(zone) == ZONE_MOVABLE) if (zone_idx(zone) == ZONE_MOVABLE)
return true; return false;
mt = get_pageblock_migratetype(page); mt = get_pageblock_migratetype(page);
if (mt == MIGRATE_MOVABLE || is_migrate_cma(mt)) if (mt == MIGRATE_MOVABLE || is_migrate_cma(mt))
return true; return false;
pfn = page_to_pfn(page); pfn = page_to_pfn(page);
for (found = 0, iter = 0; iter < pageblock_nr_pages; iter++) { 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,9 +5530,9 @@ __count_immobile_pages(struct zone *zone, struct page *page, int count)
* page at boot. * page at boot.
*/ */
if (found > count) if (found > count)
return false; return true;
} }
return true; return false;
} }
bool is_pageblock_removable_nolock(struct page *page) bool is_pageblock_removable_nolock(struct page *page)
...@@ -5554,7 +5556,7 @@ bool is_pageblock_removable_nolock(struct page *page) ...@@ -5554,7 +5556,7 @@ bool is_pageblock_removable_nolock(struct page *page)
zone->zone_start_pfn + zone->spanned_pages <= pfn) zone->zone_start_pfn + zone->spanned_pages <= pfn)
return false; return false;
return __count_immobile_pages(zone, page, 0); return !__has_unmovable_pages(zone, page, 0);
} }
int set_migratetype_isolate(struct page *page) int set_migratetype_isolate(struct page *page)
...@@ -5593,12 +5595,12 @@ int set_migratetype_isolate(struct page *page) ...@@ -5593,12 +5595,12 @@ int set_migratetype_isolate(struct page *page)
* FIXME: Now, memory hotplug doesn't call shrink_slab() by itself. * FIXME: Now, memory hotplug doesn't call shrink_slab() by itself.
* We just check MOVABLE pages. * We just check MOVABLE pages.
*/ */
if (__count_immobile_pages(zone, page, arg.pages_found)) if (!__has_unmovable_pages(zone, page, arg.pages_found))
ret = 0; ret = 0;
/* /*
* immobile means "not-on-lru" paes. If immobile is larger than * Unmovable means "not-on-lru" pages. If Unmovable pages are
* removable-by-driver pages reported by notifier, we'll fail. * larger than removable-by-driver pages reported by notifier,
* we'll fail.
*/ */
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment