public inbox for linux-mm@kvack.org
 help / color / mirror / Atom feed
From: Ezequiel Garcia <elezegarcia@gmail.com>
To: linux-mm@kvack.org
Cc: Ezequiel Garcia <elezegarcia@gmail.com>,
	Pekka Enberg <penberg@kernel.org>,
	Christoph Lameter <cl@linux.com>,
	Glauber Costa <glommer@parallels.com>
Subject: [PATCH 1/2] mm, slob: Prevent false positive trace upon allocation failure
Date: Tue, 14 Aug 2012 11:38:49 -0300	[thread overview]
Message-ID: <1344955130-29478-1-git-send-email-elezegarcia@gmail.com> (raw)

This patch changes the __kmalloc_node() logic to return NULL
if alloc_pages() fails to return valid pages.
This is done to avoid to trace a false positive kmalloc event.

Cc: Pekka Enberg <penberg@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Glauber Costa <glommer@parallels.com>
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com>
---
 mm/slob.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/mm/slob.c b/mm/slob.c
index 45d4ca7..686e98b 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -450,15 +450,16 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
 				   size, size + align, gfp, node);
 	} else {
 		unsigned int order = get_order(size);
+		struct page *page;
 
 		if (likely(order))
 			gfp |= __GFP_COMP;
 		ret = slob_new_pages(gfp, order, node);
-		if (ret) {
-			struct page *page;
-			page = virt_to_page(ret);
-			page->private = size;
-		}
+		if (!ret)
+			return NULL;
+
+		page = virt_to_page(ret);
+		page->private = size;
 
 		trace_kmalloc_node(_RET_IP_, ret,
 				   size, PAGE_SIZE << order, gfp, node);
-- 
1.7.8.6

--
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:[~2012-08-14 14:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 14:38 Ezequiel Garcia [this message]
2012-08-14 14:38 ` [RFC/PATCH 2/2] mm, slob: Save real allocated size in page->private Ezequiel Garcia
2012-08-14 14:56   ` Christoph Lameter
2012-08-14 15:06     ` Ezequiel Garcia
2012-08-14 14:52 ` [PATCH 1/2] mm, slob: Prevent false positive trace upon allocation failure Christoph Lameter
2012-08-15 12:34 ` Ezequiel Garcia
2012-08-15 12:43   ` Pekka Enberg
2012-09-04  7:32 ` Pekka Enberg
2012-09-04  9:39   ` Ezequiel Garcia

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=1344955130-29478-1-git-send-email-elezegarcia@gmail.com \
    --to=elezegarcia@gmail.com \
    --cc=cl@linux.com \
    --cc=glommer@parallels.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    /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