diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ae721a713bda..c42ec374df96 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3085,7 +3085,6 @@ out: | |||
3085 | return page; | 3085 | return page; |
3086 | } | 3086 | } |
3087 | 3087 | ||
3088 | |||
3089 | /* | 3088 | /* |
3090 | * Maximum number of compaction retries wit a progress before OOM | 3089 | * Maximum number of compaction retries wit a progress before OOM |
3091 | * killer is consider as the only way to move forward. | 3090 | * killer is consider as the only way to move forward. |
@@ -3373,11 +3372,6 @@ bool gfp_pfmemalloc_allowed(gfp_t gfp_mask) | |||
3373 | return false; | 3372 | return false; |
3374 | } | 3373 | } |
3375 | 3374 | ||
3376 | static inline bool is_thp_gfp_mask(gfp_t gfp_mask) | ||
3377 | { | ||
3378 | return (gfp_mask & (GFP_TRANSHUGE | __GFP_KSWAPD_RECLAIM)) == GFP_TRANSHUGE; | ||
3379 | } | ||
3380 | |||
3381 | /* | 3375 | /* |
3382 | * Maximum number of reclaim retries without any progress before OOM killer | 3376 | * Maximum number of reclaim retries without any progress before OOM killer |
3383 | * is consider as the only way to move forward. | 3377 | * is consider as the only way to move forward. |
@@ -3536,8 +3530,11 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, | |||
3536 | if (page) | 3530 | if (page) |
3537 | goto got_pg; | 3531 | goto got_pg; |
3538 | 3532 | ||
3539 | /* Checks for THP-specific high-order allocations */ | 3533 | /* |
3540 | if (is_thp_gfp_mask(gfp_mask)) { | 3534 | * Checks for costly allocations with __GFP_NORETRY, which |
3535 | * includes THP page fault allocations | ||
3536 | */ | ||
3537 | if (gfp_mask & __GFP_NORETRY) { | ||
3541 | /* | 3538 | /* |
3542 | * If compaction is deferred for high-order allocations, | 3539 | * If compaction is deferred for high-order allocations, |
3543 | * it is because sync compaction recently failed. If | 3540 | * it is because sync compaction recently failed. If |
@@ -3557,11 +3554,10 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, | |||
3557 | goto nopage; | 3554 | goto nopage; |
3558 | 3555 | ||
3559 | /* | 3556 | /* |
3560 | * It can become very expensive to allocate transparent | 3557 | * Looks like reclaim/compaction is worth trying, but |
3561 | * hugepages at fault, so use asynchronous memory | 3558 | * sync compaction could be very expensive, so keep |
3562 | * compaction for THP unless it is khugepaged trying to | 3559 | * using async compaction, unless it's khugepaged |
3563 | * collapse. All other requests should tolerate at | 3560 | * trying to collapse. |
3564 | * least light sync migration. | ||
3565 | */ | 3561 | */ |
3566 | if (!(current->flags & PF_KTHREAD)) | 3562 | if (!(current->flags & PF_KTHREAD)) |
3567 | migration_mode = MIGRATE_ASYNC; | 3563 | migration_mode = MIGRATE_ASYNC; |