mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	oom: invoke oom killer for __GFP_NOFAIL
The oom killer must be invoked regardless of the order if the allocation is __GFP_NOFAIL, otherwise it will loop forever when reclaim fails to free some memory. Cc: Nick Piggin <npiggin@suse.de> Acked-by: Rik van Riel <riel@redhat.com> Acked-by: Mel Gorman <mel@csn.ul.ie> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Dave Hansen <dave@linux.vnet.ibm.com> Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									4d8b9135c3
								
							
						
					
					
						commit
						82553a937f
					
				
					 1 changed files with 7 additions and 5 deletions
				
			
		| 
						 | 
					@ -1561,7 +1561,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* The OOM killer will not help higher order allocs */
 | 
						/* The OOM killer will not help higher order allocs */
 | 
				
			||||||
	if (order > PAGE_ALLOC_COSTLY_ORDER)
 | 
						if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_NOFAIL))
 | 
				
			||||||
		goto out;
 | 
							goto out;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Exhausted what can be done so it's blamo time */
 | 
						/* Exhausted what can be done so it's blamo time */
 | 
				
			||||||
| 
						 | 
					@ -1781,11 +1781,13 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 | 
				
			||||||
				goto got_pg;
 | 
									goto got_pg;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			/*
 | 
								/*
 | 
				
			||||||
			 * The OOM killer does not trigger for high-order allocations
 | 
								 * The OOM killer does not trigger for high-order
 | 
				
			||||||
			 * but if no progress is being made, there are no other
 | 
								 * ~__GFP_NOFAIL allocations so if no progress is being
 | 
				
			||||||
			 * options and retrying is unlikely to help
 | 
								 * made, there are no other options and retrying is
 | 
				
			||||||
 | 
								 * unlikely to help.
 | 
				
			||||||
			 */
 | 
								 */
 | 
				
			||||||
			if (order > PAGE_ALLOC_COSTLY_ORDER)
 | 
								if (order > PAGE_ALLOC_COSTLY_ORDER &&
 | 
				
			||||||
 | 
											!(gfp_mask & __GFP_NOFAIL))
 | 
				
			||||||
				goto nopage;
 | 
									goto nopage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			goto restart;
 | 
								goto restart;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue