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()
155 spin_lock_irqsave(&zone->lock, flags); in set_migratetype_isolate()
163 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
164 return -EBUSY; in set_migratetype_isolate()
185 zone->nr_isolate_pageblock++; in set_migratetype_isolate()
189 __mod_zone_freepage_state(zone, -nr_pages, mt); in set_migratetype_isolate()
190 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
194 spin_unlock_irqrestore(&zone->lock, flags); in set_migratetype_isolate()
197 * printk() with zone->lock held will likely trigger a in set_migratetype_isolate()
203 return -EBUSY; in set_migratetype_isolate()
215 spin_lock_irqsave(&zone->lock, flags); in unset_migratetype_isolate()
251 * onlining - just onlined memory won't immediately be considered for in unset_migratetype_isolate()
261 zone->nr_isolate_pageblock--; in unset_migratetype_isolate()
263 spin_unlock_irqrestore(&zone->lock, flags); in unset_migratetype_isolate()
283 * isolate_single_pageblock() -- tries to isolate a pageblock that might be
284 * within a free or in-use page.
285 * @boundary_pfn: pageblock-aligned pfn that a page might cross
293 * Free and in-use pages can be as big as MAX_PAGE_ORDER and contain more than one
302 * in-use page and freed later, __free_one_page() does not split the free page
304 * the in-use page then splitting the free page.
319 isolate_pageblock = boundary_pfn - pageblock_nr_pages; in isolate_single_pageblock()
326 * free or in-use page. Also make sure all to-be-isolated pageblocks in isolate_single_pageblock()
331 zone->zone_start_pfn); in isolate_single_pageblock()
346 * Bail out early when the to-be-isolated pageblock does not form in isolate_single_pageblock()
347 * a free or in-use page across boundary_pfn: in isolate_single_pageblock()
361 if (!pfn_to_online_page(boundary_pfn - 1)) in isolate_single_pageblock()
366 struct page *page = __first_valid_page(pfn, boundary_pfn - pfn); in isolate_single_pageblock()
380 if (split_free_page(page, order, boundary_pfn - pfn)) in isolate_single_pageblock()
412 .order = -1, in isolate_single_pageblock()
481 return -EBUSY; in isolate_single_pageblock()
485 * start_isolate_page_range() - mark page range MIGRATE_ISOLATE
491 * MEMORY_OFFLINE - isolate to offline (!allocate) memory
494 * REPORT_FAILURE - report details about the failure to
499 * Making page-allocation-type to be MIGRATE_ISOLATE means free pages in
502 * other than MOVABLE or CMA, this will fail with -EBUSY. For isolating all
511 * from trying to isolate overlapping ranges. If this happens, one thread
512 * will notice pageblocks in the overlapping range already set to isolate.
515 * pageblocks we may have modified and return -EBUSY to caller. This
516 * prevents two threads from simultaneously working on overlapping ranges.
527 * Return: 0 on success and -EBUSY if any part of range cannot be isolated.
546 if (isolate_start == isolate_end - pageblock_nr_pages) in start_isolate_page_range()
549 /* isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock */ in start_isolate_page_range()
559 pfn < isolate_end - pageblock_nr_pages; in start_isolate_page_range()
566 pfn_to_page(isolate_end - pageblock_nr_pages), in start_isolate_page_range()
568 return -EBUSY; in start_isolate_page_range()
575 * undo_isolate_page_range - undo effects of start_isolate_page_range()
603 * zone->lock must be held before call this.
641 * test_pages_isolated - check if pageblocks in range are isolated
653 * Returns 0 if true, -EBUSY if one or more pages are in use.
673 page = __first_valid_page(start_pfn, end_pfn - start_pfn); in test_pages_isolated()
675 ret = -EBUSY; in test_pages_isolated()
681 spin_lock_irqsave(&zone->lock, flags); in test_pages_isolated()
683 spin_unlock_irqrestore(&zone->lock, flags); in test_pages_isolated()
685 ret = pfn < end_pfn ? -EBUSY : 0; in test_pages_isolated()