Lines Matching +full:non +full:- +full:overlapping

1 // SPDX-License-Identifier: GPL-2.0
7 #include <linux/page-isolation.h>
8 #include <linux/pageblock-flags.h>
25 * check without lock_page also may miss some movable non-lru pages at
41 pageblock_start_pfn(end_pfn - 1)); in has_unmovable_pages()
92 skip_pages = folio_nr_pages(folio) - folio_page_idx(folio, page); in has_unmovable_pages()
93 pfn += skip_pages - 1; in has_unmovable_pages()
101 * because their page->_refcount is zero at all time. in has_unmovable_pages()
105 pfn += (1 << buddy_order(page)) - 1; in has_unmovable_pages()
158 spin_lock_irqsave(&zone->lock, flags); in set_migratetype_isolate()
166 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
167 return -EBUSY; in set_migratetype_isolate()
185 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
186 return -EBUSY; in set_migratetype_isolate()
188 zone->nr_isolate_pageblock++; in set_migratetype_isolate()
189 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
193 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
196 * printk() with zone->lock held will likely trigger a in set_migratetype_isolate()
202 return -EBUSY; in set_migratetype_isolate()
214 spin_lock_irqsave(&zone->lock, flags); in unset_migratetype_isolate()
250 * onlining - just onlined memory won't immediately be considered for in unset_migratetype_isolate()
263 zone->nr_isolate_pageblock--; in unset_migratetype_isolate()
265 spin_unlock_irqrestore(&zone->lock, flags); in unset_migratetype_isolate()
285 * isolate_single_pageblock() -- tries to isolate a pageblock that might be
286 * within a free or in-use page.
287 * @boundary_pfn: pageblock-aligned pfn that a page might cross
295 * Free and in-use pages can be as big as MAX_PAGE_ORDER and contain more than one
304 * in-use page and freed later, __free_one_page() does not split the free page
306 * the in-use page then splitting the free page.
321 isolate_pageblock = boundary_pfn - pageblock_nr_pages; in isolate_single_pageblock()
328 * free or in-use page. Also make sure all to-be-isolated pageblocks in isolate_single_pageblock()
333 zone->zone_start_pfn); in isolate_single_pageblock()
348 * Bail out early when the to-be-isolated pageblock does not form in isolate_single_pageblock()
349 * a free or in-use page across boundary_pfn: in isolate_single_pageblock()
363 if (!pfn_to_online_page(boundary_pfn - 1)) in isolate_single_pageblock()
368 struct page *page = __first_valid_page(pfn, boundary_pfn - pfn); in isolate_single_pageblock()
394 * pages are freed as order-0 chunks, and LRU pages in isolate_single_pageblock()
432 return -EBUSY; in isolate_single_pageblock()
436 * start_isolate_page_range() - mark page range MIGRATE_ISOLATE
442 * MEMORY_OFFLINE - isolate to offline (!allocate) memory
445 * REPORT_FAILURE - report details about the failure to
450 * Making page-allocation-type to be MIGRATE_ISOLATE means free pages in
453 * other than MOVABLE or CMA, this will fail with -EBUSY. For isolating all
462 * from trying to isolate overlapping ranges. If this happens, one thread
463 * will notice pageblocks in the overlapping range already set to isolate.
466 * pageblocks we may have modified and return -EBUSY to caller. This
467 * prevents two threads from simultaneously working on overlapping ranges.
478 * Return: 0 on success and -EBUSY if any part of range cannot be isolated.
497 if (isolate_start == isolate_end - pageblock_nr_pages) in start_isolate_page_range()
500 /* isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock */ in start_isolate_page_range()
510 pfn < isolate_end - pageblock_nr_pages; in start_isolate_page_range()
517 pfn_to_page(isolate_end - pageblock_nr_pages), in start_isolate_page_range()
519 return -EBUSY; in start_isolate_page_range()
526 * undo_isolate_page_range - undo effects of start_isolate_page_range()
554 * zone->lock must be held before call this.
592 * test_pages_isolated - check if pageblocks in range are isolated
604 * Returns 0 if true, -EBUSY if one or more pages are in use.
624 page = __first_valid_page(start_pfn, end_pfn - start_pfn); in test_pages_isolated()
626 ret = -EBUSY; in test_pages_isolated()
632 spin_lock_irqsave(&zone->lock, flags); in test_pages_isolated()
634 spin_unlock_irqrestore(&zone->lock, flags); in test_pages_isolated()
636 ret = pfn < end_pfn ? -EBUSY : 0; in test_pages_isolated()