Re: __GFP_NOFAIL and oom_killer_disabled?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michal Hocko wrote:
> What about something like the following?

I'm fine with whatever approaches as long as retry is guaranteed.

But maybe we can use memory reserves like below? I think there will be
little risk because userspace processes are already frozen...

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a47f0b2..cea0a1b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2760,8 +2760,17 @@ retry:
 							&did_some_progress);
 			if (page)
 				goto got_pg;
-			if (!did_some_progress)
+			if (!did_some_progress && !(gfp_mask & __GFP_NOFAIL))
 				goto nopage;
+			/*
+			 * What!? __GFP_NOFAIL allocation failed to invoke
+			 * the OOM killer due to oom_killer_disabled == true?
+			 * Then, pretend ALLOC_NO_WATERMARKS request and let
+			 * __alloc_pages_high_priority() retry forever...
+			 */
+			WARN(1, "Retrying GFP_NOFAIL allocation...\n");
+			gfp_mask &= ~__GFP_NOMEMALLOC;
+			gfp_mask |= __GFP_MEMALLOC;
 		}
 		/* Wait for some write requests to complete then retry */
 		wait_iff_congested(ac->preferred_zone, BLK_RW_ASYNC, HZ/50);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]