*参照元 [#j99e3078] #backlinks *説明 [#xdf1a2c6] -パス: [[linux-4.4.1/mm/page_isolation.c]] -FIXME: これは何? --説明 **引数 [#a3e91d79] -unsigned long start_pfn -- -unsigned long end_pfn -- -bool skip_hwpoisoned_pages -- **返り値 [#a4d8fd44] -int --成功ならば 0、失敗ならば負のエラー値 **参考 [#l3de4210] *実装 [#na7a90b4] int test_pages_isolated(unsigned long start_pfn, unsigned long end_pfn, bool skip_hwpoisoned_pages) { unsigned long pfn, flags; struct page *page; struct zone *zone; int ret; - --[[linux-4.4.1/page]] --[[linux-4.4.1/zone]] /* * Note: pageblock_nr_pages != MAX_ORDER. Then, chunks of free pages * are not aligned to pageblock_nr_pages. * Then we just check migratetype first. */ for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) { page = __first_valid_page(pfn, pageblock_nr_pages); if (page && get_pageblock_migratetype(page) != MIGRATE_ISOLATE) break; } - --[[linux-4.4.1/pageblock_nr_pages(global)]] --[[linux-4.4.1/__first_valid_page()]] --[[linux-4.4.1/get_pageblock_migratetype()]] page = __first_valid_page(start_pfn, end_pfn - start_pfn); if ((pfn < end_pfn) || !page) return -EBUSY; /* Check all pages are free or marked as ISOLATED */ zone = page_zone(page); spin_lock_irqsave(&zone->lock, flags); ret = __test_page_isolated_in_pageblock(start_pfn, end_pfn, skip_hwpoisoned_pages); spin_unlock_irqrestore(&zone->lock, flags); - --[[linux-4.4.1/page_zone()]] --[[linux-4.4.1/spin_lock_irqsave()]] --[[linux-4.4.1/__test_page_isolated_in_pageblock()]] --[[linux-4.4.1/spin_unlock_irqrestore()]] return ret ? 0 : -EBUSY; } *コメント [#y64f7d41]