diff options
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r-- | mm/page_alloc.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 64b7d82a9b1a..6d30e914afb6 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -3284,6 +3284,14 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, | |||
3284 | /* The OOM killer will not help higher order allocs */ | 3284 | /* The OOM killer will not help higher order allocs */ |
3285 | if (order > PAGE_ALLOC_COSTLY_ORDER) | 3285 | if (order > PAGE_ALLOC_COSTLY_ORDER) |
3286 | goto out; | 3286 | goto out; |
3287 | /* | ||
3288 | * We have already exhausted all our reclaim opportunities without any | ||
3289 | * success so it is time to admit defeat. We will skip the OOM killer | ||
3290 | * because it is very likely that the caller has a more reasonable | ||
3291 | * fallback than shooting a random task. | ||
3292 | */ | ||
3293 | if (gfp_mask & __GFP_RETRY_MAYFAIL) | ||
3294 | goto out; | ||
3287 | /* The OOM killer does not needlessly kill tasks for lowmem */ | 3295 | /* The OOM killer does not needlessly kill tasks for lowmem */ |
3288 | if (ac->high_zoneidx < ZONE_NORMAL) | 3296 | if (ac->high_zoneidx < ZONE_NORMAL) |
3289 | goto out; | 3297 | goto out; |
@@ -3413,7 +3421,7 @@ should_compact_retry(struct alloc_context *ac, int order, int alloc_flags, | |||
3413 | } | 3421 | } |
3414 | 3422 | ||
3415 | /* | 3423 | /* |
3416 | * !costly requests are much more important than __GFP_REPEAT | 3424 | * !costly requests are much more important than __GFP_RETRY_MAYFAIL |
3417 | * costly ones because they are de facto nofail and invoke OOM | 3425 | * costly ones because they are de facto nofail and invoke OOM |
3418 | * killer to move on while costly can fail and users are ready | 3426 | * killer to move on while costly can fail and users are ready |
3419 | * to cope with that. 1/4 retries is rather arbitrary but we | 3427 | * to cope with that. 1/4 retries is rather arbitrary but we |
@@ -3920,9 +3928,9 @@ retry: | |||
3920 | 3928 | ||
3921 | /* | 3929 | /* |
3922 | * Do not retry costly high order allocations unless they are | 3930 | * Do not retry costly high order allocations unless they are |
3923 | * __GFP_REPEAT | 3931 | * __GFP_RETRY_MAYFAIL |
3924 | */ | 3932 | */ |
3925 | if (costly_order && !(gfp_mask & __GFP_REPEAT)) | 3933 | if (costly_order && !(gfp_mask & __GFP_RETRY_MAYFAIL)) |
3926 | goto nopage; | 3934 | goto nopage; |
3927 | 3935 | ||
3928 | if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, | 3936 | if (should_reclaim_retry(gfp_mask, order, ac, alloc_flags, |