参照元

説明

引数

返り値

参考

実装

/* [start, end) must belong to a single zone. */
static int __alloc_contig_migrate_range(struct compact_control *cc,
                                        unsigned long start, unsigned long end)
{               
        /* This function is based on compact_zone() from compaction.c. */
        unsigned long nr_reclaimed;
        unsigned long pfn = start;
        unsigned int tries = 0;
        int ret = 0;    

        migrate_prep();
        while (pfn < end || !list_empty(&cc->migratepages)) {
                if (fatal_signal_pending(current)) {
                        ret = -EINTR;
                        break;
                }
                if (list_empty(&cc->migratepages)) {
                        cc->nr_migratepages = 0;
                        pfn = isolate_migratepages_range(cc, pfn, end);
                        if (!pfn) {
                                ret = -EINTR;
                                break;
                        }
                        tries = 0;
                } else if (++tries == 5) {
                        ret = ret < 0 ? ret : -EBUSY;
                        break;
                }
                nr_reclaimed = reclaim_clean_pages_from_list(cc->zone,
                                                        &cc->migratepages);
                cc->nr_migratepages -= nr_reclaimed;
                ret = migrate_pages(&cc->migratepages, alloc_migrate_target,
                                    NULL, 0, cc->mode, MR_CMA);
        }
        if (ret < 0) {
                putback_movable_pages(&cc->migratepages);
                return ret;
        }
        return 0;
}

コメント


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS