up_read(&b->conf_sem);
return ret;
}
-
-/**
- * vmballoon_compaction_init() - initialized compaction for the balloon.
- *
- * @b: pointer to the balloon.
- *
- * If during the initialization a failure occurred, this function does not
- * perform cleanup. The caller must call vmballoon_compaction_deinit() in this
- * case.
- *
- * Return: zero on success or error code on failure.
- */
-static __init void vmballoon_compaction_init(struct vmballoon *b)
-{
- b->b_dev_info.migratepage = vmballoon_migratepage;
-}
-
#else /* CONFIG_BALLOON_COMPACTION */
-static inline void vmballoon_compaction_init(struct vmballoon *b)
-{
-}
+int vmballoon_migratepage(struct balloon_dev_info *b_dev_info,
+ struct page *newpage, struct page *page,
+ enum migrate_mode mode);
#endif /* CONFIG_BALLOON_COMPACTION */
static int __init vmballoon_init(void)
if (error)
return error;
- /*
- * Initialization of compaction must be done after the call to
- * balloon_devinfo_init() .
- */
balloon_devinfo_init(&balloon.b_dev_info);
- vmballoon_compaction_init(&balloon);
+ if (IS_ENABLED(CONFIG_BALLOON_COMPACTION))
+ balloon.b_dev_info.migratepage = vmballoon_migratepage;
INIT_LIST_HEAD(&balloon.huge_pages);
spin_lock_init(&balloon.comm_lock);