linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@sgi.com>
To: Jesper Juhl <jesper.juhl@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	James Bottomley <James.Bottomley@steeleye.com>,
	Pekka Enberg <penberg@cs.helsinki.fi>,
	linux-mm@kvack.org, Ingo Molnar <mingo@elte.hu>,
	Matt Mackall <mpm@selenic.com>
Subject: Re: [PATCH] Fix two potential mem leaks in MPT Fusion (mpt_attach())
Date: Thu, 2 Aug 2007 17:47:26 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0708021738050.13312@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <9a8748490708021626s58f0f7cew54932e523800e982@mail.gmail.com>

Mempools do not want to wait if there is an allocation failure. Its like 
GFP_THISNODE in that we want a failure.

I had to add a

if (NUMA_BUILD && (gfp_mask & GFP_THISNODE) == GFP_THISNODE)
                goto nopage;

in page_alloc.c to make GFP_THISNODE fail.

Maybe add a GFP_FAIL and check for that?


diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index bc68dd9..41b6aa3 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -43,6 +43,7 @@ struct vm_area_struct;
 #define __GFP_REPEAT	((__force gfp_t)0x400u)	/* Retry the allocation.  Might fail */
 #define __GFP_NOFAIL	((__force gfp_t)0x800u)	/* Retry for ever.  Cannot fail */
 #define __GFP_NORETRY	((__force gfp_t)0x1000u)/* Do not retry.  Might fail */
+#define __GFP_FAIL	((__force gfp_t)0x2000u)/* Fail immediately if there is a problem */
 #define __GFP_COMP	((__force gfp_t)0x4000u)/* Add compound page metadata */
 #define __GFP_ZERO	((__force gfp_t)0x8000u)/* Return zeroed page on success */
 #define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u) /* Don't use emergency reserves */
@@ -81,7 +82,8 @@ struct vm_area_struct;
 				 __GFP_MOVABLE)
 
 #ifdef CONFIG_NUMA
-#define GFP_THISNODE	(__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY)
+#define GFP_THISNODE	(__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY |\
+				__GFP_FAIL)
 #else
 #define GFP_THISNODE	((__force gfp_t)0)
 #endif
diff --git a/mm/mempool.c b/mm/mempool.c
index 02d5ec3..c1ac622 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -211,8 +211,9 @@ void * mempool_alloc(mempool_t *pool, gfp_t gfp_mask)
 	gfp_mask |= __GFP_NOMEMALLOC;	/* don't allocate emergency reserves */
 	gfp_mask |= __GFP_NORETRY;	/* don't loop in __alloc_pages */
 	gfp_mask |= __GFP_NOWARN;	/* failures are OK */
+	gfp_mask |= __GFP_FAIL;
 
-	gfp_temp = gfp_mask & ~(__GFP_WAIT|__GFP_IO);
+	gfp_temp = gfp_mask & ~__GFP_IO;
 
 repeat_alloc:
 
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3da85b8..58c1a4d 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1250,15 +1250,7 @@ restart:
 	if (page)
 		goto got_pg;
 
-	/*
-	 * GFP_THISNODE (meaning __GFP_THISNODE, __GFP_NORETRY and
-	 * __GFP_NOWARN set) should not cause reclaim since the subsystem
-	 * (f.e. slab) using GFP_THISNODE may choose to trigger reclaim
-	 * using a larger set of nodes after it has established that the
-	 * allowed per node queues are empty and that nodes are
-	 * over allocated.
-	 */
-	if (NUMA_BUILD && (gfp_mask & GFP_THISNODE) == GFP_THISNODE)
+	if (gfp_mask & __GFP_FAIL)
 		goto nopage;
 
 	for (z = zonelist->zones; *z; z++)



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

      reply	other threads:[~2007-08-03  0:47 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200708020155.33690.jesper.juhl@gmail.com>
     [not found] ` <20070801172653.1fd44e99.akpm@linux-foundation.org>
     [not found]   ` <9a8748490708020120w4bbfe6d1n6f6986aec507316@mail.gmail.com>
2007-08-02 22:53     ` Jesper Juhl
2007-08-02 23:04       ` Andrew Morton
2007-08-02 23:10         ` Jesper Juhl
2007-08-02 23:17           ` Andrew Morton
2007-08-02 23:26             ` Jesper Juhl
2007-08-03  0:47               ` Christoph Lameter [this message]

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=Pine.LNX.4.64.0708021738050.13312@schroedinger.engr.sgi.com \
    --to=clameter@sgi.com \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@linux-foundation.org \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=mpm@selenic.com \
    --cc=penberg@cs.helsinki.fi \
    /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