page_alloc.c (b06eda091e5d65bbfce183ad3403ab3d153bef9f) page_alloc.c (1da2f328fa643bd72197dfed0c655148af31e4eb)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/mm/page_alloc.c
4 *
5 * Manages the free list, the system allocates free pages here.
6 * Note that kmalloc() lives in slab.c
7 *
8 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds

--- 8237 unchanged lines hidden (view full) ---

8246 * pages then it should be reasonably safe to assume the rest
8247 * is movable.
8248 */
8249 if (zone_idx(zone) == ZONE_MOVABLE)
8250 continue;
8251
8252 /*
8253 * Hugepages are not in LRU lists, but they're movable.
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/mm/page_alloc.c
4 *
5 * Manages the free list, the system allocates free pages here.
6 * Note that kmalloc() lives in slab.c
7 *
8 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds

--- 8237 unchanged lines hidden (view full) ---

8246 * pages then it should be reasonably safe to assume the rest
8247 * is movable.
8248 */
8249 if (zone_idx(zone) == ZONE_MOVABLE)
8250 continue;
8251
8252 /*
8253 * Hugepages are not in LRU lists, but they're movable.
8254 * THPs are on the LRU, but need to be counted as #small pages.
8254 * We need not scan over tail pages because we don't
8255 * handle each tail page individually in migration.
8256 */
8255 * We need not scan over tail pages because we don't
8256 * handle each tail page individually in migration.
8257 */
8257 if (PageHuge(page)) {
8258 if (PageHuge(page) || PageTransCompound(page)) {
8258 struct page *head = compound_head(page);
8259 unsigned int skip_pages;
8260
8259 struct page *head = compound_head(page);
8260 unsigned int skip_pages;
8261
8261 if (!hugepage_migration_supported(page_hstate(head)))
8262 if (PageHuge(page)) {
8263 if (!hugepage_migration_supported(page_hstate(head)))
8264 return page;
8265 } else if (!PageLRU(head) && !__PageMovable(head)) {
8262 return page;
8266 return page;
8267 }
8263
8264 skip_pages = compound_nr(head) - (page - head);
8265 iter += skip_pages - 1;
8266 continue;
8267 }
8268
8269 /*
8270 * We can't use page_count without pin a page

--- 497 unchanged lines hidden ---
8268
8269 skip_pages = compound_nr(head) - (page - head);
8270 iter += skip_pages - 1;
8271 continue;
8272 }
8273
8274 /*
8275 * We can't use page_count without pin a page

--- 497 unchanged lines hidden ---