public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <nigel@nigel.suspend2.net>
To: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Should GFP_ATOMIC fail when we're below low watermark?
Date: Mon, 20 Aug 2007 11:38:49 +1000	[thread overview]
Message-ID: <200708201138.50508.nigel@nigel.suspend2.net> (raw)

Hi all.

In current git (and for a while now), an attempt to allocate memory with 
GFP_ATOMIC will fail if we're below the low watermark level. The only way to 
access that memory that I can see (not that I've looked that hard) is to have 
PF_MEMALLOC set (ie from kswapd). I'm wondering if this behaviour is correct. 
Shouldn't GFP_ATOMIC allocations ignore watermarks too? How about GFP_KERNEL?

The following patch is a potential fix for GFP_ATOMIC.

Regards,

Nigel

Signed-off-by: Nigel Cunningham <nigel@nigel.suspend2.net>

 page_alloc.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff -ruNp 995-gfp-atomic-alloc.patch-old/mm/page_alloc.c 995-gfp-atomic-alloc.patch-new/mm/page_alloc.c
--- 995-gfp-atomic-alloc.patch-old/mm/page_alloc.c	2007-08-20 11:14:34.000000000 +1000
+++ 995-gfp-atomic-alloc.patch-new/mm/page_alloc.c	2007-08-20 11:11:09.000000000 +1000
@@ -1286,8 +1286,8 @@ restart:
 	/* This allocation should allow future memory freeing. */
 
 rebalance:
-	if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)))
-			&& !in_interrupt()) {
+	if (((p->flags & PF_MEMALLOC) || unlikely(test_thread_flag(TIF_MEMDIE)) ||
+			(gfp_mask & GFP_ATOMIC)) && !in_interrupt()) {
 		if (!(gfp_mask & __GFP_NOMEMALLOC)) {
 nofail_alloc:
 			/* go through the zonelist yet again, ignoring mins */

-- 
See http://www.tuxonice.net for Howtos, FAQs, mailing
lists, wiki and bugzilla info.

             reply	other threads:[~2007-08-20  1:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20  1:38 Nigel Cunningham [this message]
2007-08-20  2:43 ` [PATCH] Should GFP_ATOMIC fail when we're below low watermark? Peter Zijlstra
2007-08-20  8:38   ` Nigel Cunningham
2007-08-20  8:59     ` Peter Zijlstra
2007-08-20 10:55       ` Nigel Cunningham
2007-08-20 11:06         ` Peter Zijlstra
2007-08-20 11:41           ` Nigel Cunningham
2007-08-20 16:09           ` Randy Dunlap
2007-08-21 11:02           ` Mel Gorman
2007-08-20 19:11         ` Rafael J. Wysocki
2007-08-21 11:03         ` Mel Gorman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200708201138.50508.nigel@nigel.suspend2.net \
    --to=nigel@nigel.suspend2.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nigel@suspend2.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox