|
@@ -2638,14 +2638,6 @@ rebalance:
|
|
|
if (page)
|
|
|
goto got_pg;
|
|
|
|
|
|
- /*
|
|
|
- * It can become very expensive to allocate transparent hugepages at
|
|
|
- * fault, so use asynchronous memory compaction for THP unless it is
|
|
|
- * khugepaged trying to collapse.
|
|
|
- */
|
|
|
- if (!(gfp_mask & __GFP_NO_KSWAPD) || (current->flags & PF_KTHREAD))
|
|
|
- migration_mode = MIGRATE_SYNC_LIGHT;
|
|
|
-
|
|
|
/*
|
|
|
* If compaction is deferred for high-order allocations, it is because
|
|
|
* sync compaction recently failed. In this is the case and the caller
|
|
@@ -2656,6 +2648,15 @@ rebalance:
|
|
|
(gfp_mask & __GFP_NO_KSWAPD))
|
|
|
goto nopage;
|
|
|
|
|
|
+ /*
|
|
|
+ * It can become very expensive to allocate transparent hugepages at
|
|
|
+ * fault, so use asynchronous memory compaction for THP unless it is
|
|
|
+ * khugepaged trying to collapse.
|
|
|
+ */
|
|
|
+ if ((gfp_mask & GFP_TRANSHUGE) != GFP_TRANSHUGE ||
|
|
|
+ (current->flags & PF_KTHREAD))
|
|
|
+ migration_mode = MIGRATE_SYNC_LIGHT;
|
|
|
+
|
|
|
/* Try direct reclaim and then allocating */
|
|
|
page = __alloc_pages_direct_reclaim(gfp_mask, order,
|
|
|
zonelist, high_zoneidx,
|