*参照元 [#sc89772b] #backlinks *説明 [#m2d3f889] -パス: [[linux-4.4.1/mm/compaction.c]] -FIXME: これは何? --説明 **引数 [#nb9654e7] -struct compact_control *cc -- --[[linux-4.4.1/compact_control]] -unsigned long start_pfn -- -unsigned long end_pfn -- **返り値 [#e79f85d3] -unsigned long -- **参考 [#ka8688b1] *実装 [#t51f01fb] /** * isolate_migratepages_range() - isolate migrate-able pages in a PFN range * @cc: Compaction control structure. * @start_pfn: The first PFN to start isolating. * @end_pfn: The one-past-last PFN. * * Returns zero if isolation fails fatally due to e.g. pending signal. * Otherwise, function returns one-past-the-last PFN of isolated page * (which may be greater than end_pfn if end fell in a middle of a THP page). */ unsigned long isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn, unsigned long end_pfn) { unsigned long pfn, block_end_pfn; /* Scan block by block. First and last block may be incomplete */ pfn = start_pfn; block_end_pfn = ALIGN(pfn + 1, pageblock_nr_pages); - --[[linux-4.4.1/ALIGN()]] --[[linux-4.4.1/pageblock_nr_pages(global)]] for (; pfn < end_pfn; pfn = block_end_pfn, block_end_pfn += pageblock_nr_pages) { block_end_pfn = min(block_end_pfn, end_pfn); if (!pageblock_pfn_to_page(pfn, block_end_pfn, cc->zone)) continue; -範囲が大きいときは、一度に pageblock_nr_pages ページずつ処理する。 --[[linux-4.4.1/pageblock_pfn_to_page()]] pfn = isolate_migratepages_block(cc, pfn, block_end_pfn, ISOLATE_UNEVICTABLE); - --[[linux-4.4.1/isolate_migratepages_block()]] /* * In case of fatal failure, release everything that might * have been isolated in the previous iteration, and signal * the failure back to caller. */ if (!pfn) { putback_movable_pages(&cc->migratepages); cc->nr_migratepages = 0; break; } - --[[linux-4.4.1/putback_movable_pages()]] if (cc->nr_migratepages == COMPACT_CLUSTER_MAX) break; } acct_isolated(cc->zone, cc); - --[[linux-4.4.1/acct_isolated()]] return pfn; } *コメント [#z5929465]