Skip to content

Commit 8093451

Browse files
minchanktorvalds
authored andcommitted
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>
1 parent 97d255c commit 8093451

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

‎mm/page_alloc.c‎

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5471,26 +5471,28 @@ void set_pageblock_flags_group(struct page *page, unsigned long flags,
54715471
}
54725472

54735473
/*
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.
54775480
*/
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)
54815483
{
54825484
unsigned long pfn, iter, found;
54835485
int mt;
54845486

54855487
/*
54865488
* 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
54885490
*/
54895491
if (zone_idx(zone) == ZONE_MOVABLE)
5490-
return true;
5492+
return false;
54915493
mt = get_pageblock_migratetype(page);
54925494
if (mt == MIGRATE_MOVABLE || is_migrate_cma(mt))
5493-
return true;
5495+
return false;
54945496

54955497
pfn = page_to_pfn(page);
54965498
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)
55285530
* page at boot.
55295531
*/
55305532
if (found > count)
5531-
return false;
5533+
return true;
55325534
}
5533-
return true;
5535+
return false;
55345536
}
55355537

55365538
bool is_pageblock_removable_nolock(struct page *page)
@@ -5554,7 +5556,7 @@ bool is_pageblock_removable_nolock(struct page *page)
55545556
zone->zone_start_pfn + zone->spanned_pages <= pfn)
55555557
return false;
55565558

5557-
return __count_immobile_pages(zone, page, 0);
5559+
return !__has_unmovable_pages(zone, page, 0);
55585560
}
55595561

55605562
int set_migratetype_isolate(struct page *page)
@@ -5593,12 +5595,12 @@ int set_migratetype_isolate(struct page *page)
55935595
* FIXME: Now, memory hotplug doesn't call shrink_slab() by itself.
55945596
* We just check MOVABLE pages.
55955597
*/
5596-
if (__count_immobile_pages(zone, page, arg.pages_found))
5598+
if (!__has_unmovable_pages(zone, page, arg.pages_found))
55975599
ret = 0;
5598-
55995600
/*
5600-
* immobile means "not-on-lru" paes. If immobile is larger than
5601-
* removable-by-driver pages reported by notifier, we'll fail.
5601+
* Unmovable means "not-on-lru" pages. If Unmovable pages are
5602+
* larger than removable-by-driver pages reported by notifier,
5603+
* we'll fail.
56025604
*/
56035605

56045606
out:

0 commit comments

Comments
 (0)