diff options
-rw-r--r-- | mm/page_alloc.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9bd339eb04c6..527f73e4c63f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1759,6 +1759,9 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order, | |||
1759 | /* The OOM killer will not help higher order allocs */ | 1759 | /* The OOM killer will not help higher order allocs */ |
1760 | if (order > PAGE_ALLOC_COSTLY_ORDER) | 1760 | if (order > PAGE_ALLOC_COSTLY_ORDER) |
1761 | goto out; | 1761 | goto out; |
1762 | /* The OOM killer does not needlessly kill tasks for lowmem */ | ||
1763 | if (high_zoneidx < ZONE_NORMAL) | ||
1764 | goto out; | ||
1762 | /* | 1765 | /* |
1763 | * GFP_THISNODE contains __GFP_NORETRY and we never hit this. | 1766 | * GFP_THISNODE contains __GFP_NORETRY and we never hit this. |
1764 | * Sanity check for bare calls of __GFP_THISNODE, not real OOM. | 1767 | * Sanity check for bare calls of __GFP_THISNODE, not real OOM. |
@@ -2052,15 +2055,23 @@ rebalance: | |||
2052 | if (page) | 2055 | if (page) |
2053 | goto got_pg; | 2056 | goto got_pg; |
2054 | 2057 | ||
2055 | /* | 2058 | if (!(gfp_mask & __GFP_NOFAIL)) { |
2056 | * The OOM killer does not trigger for high-order | 2059 | /* |
2057 | * ~__GFP_NOFAIL allocations so if no progress is being | 2060 | * The oom killer is not called for high-order |
2058 | * made, there are no other options and retrying is | 2061 | * allocations that may fail, so if no progress |
2059 | * unlikely to help. | 2062 | * is being made, there are no other options and |
2060 | */ | 2063 | * retrying is unlikely to help. |
2061 | if (order > PAGE_ALLOC_COSTLY_ORDER && | 2064 | */ |
2062 | !(gfp_mask & __GFP_NOFAIL)) | 2065 | if (order > PAGE_ALLOC_COSTLY_ORDER) |
2063 | goto nopage; | 2066 | goto nopage; |
2067 | /* | ||
2068 | * The oom killer is not called for lowmem | ||
2069 | * allocations to prevent needlessly killing | ||
2070 | * innocent tasks. | ||
2071 | */ | ||
2072 | if (high_zoneidx < ZONE_NORMAL) | ||
2073 | goto nopage; | ||
2074 | } | ||
2064 | 2075 | ||
2065 | goto restart; | 2076 | goto restart; |
2066 | } | 2077 | } |