[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1245243130.11889.27.camel@pc1117.cambridge.arm.com>
Date: Wed, 17 Jun 2009 13:52:10 +0100
From: Catalin Marinas <catalin.marinas@....com>
To: Mel Gorman <mel@....ul.ie>
Cc: Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
torvalds@...ux-foundation.org, fengguang.wu@...el.com,
Pekka Enberg <penberg@...helsinki.fi>,
linux-kernel@...r.kernel.org
Subject: [PATCH] kmemleak: Only use GFP_KERNEL|GFP_ATOMIC for the internal
allocations
Kmemleak allocates memory for pointer tracking and it tries to avoid
using GFP_ATOMIC if the caller doesn't require it. However other gfp
flags may be passed by the caller which aren't required by kmemleak.
This patch filters the gfp flags so that only GFP_KERNEL | GFP_ATOMIC
are used.
Signed-off-by: Catalin Marinas <catalin.marinas@....com>
---
mm/kmemleak.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 58ec86c..25e2034 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -109,6 +109,9 @@
#define BYTES_PER_POINTER sizeof(void *)
+/* GFP bitmask for kmemleak internal allocations */
+#define GFP_KMEMLEAK_MASK (GFP_KERNEL | GFP_ATOMIC)
+
/* scanning area inside a memory block */
struct kmemleak_scan_area {
struct hlist_node node;
@@ -462,7 +465,7 @@ static void create_object(unsigned long ptr, size_t size, int min_count,
struct prio_tree_node *node;
struct stack_trace trace;
- object = kmem_cache_alloc(object_cache, gfp & ~GFP_SLAB_BUG_MASK);
+ object = kmem_cache_alloc(object_cache, gfp & GFP_KMEMLEAK_MASK);
if (!object) {
kmemleak_panic("kmemleak: Cannot allocate a kmemleak_object "
"structure\n");
@@ -636,7 +639,7 @@ static void add_scan_area(unsigned long ptr, unsigned long offset,
return;
}
- area = kmem_cache_alloc(scan_area_cache, gfp & ~GFP_SLAB_BUG_MASK);
+ area = kmem_cache_alloc(scan_area_cache, gfp & GFP_KMEMLEAK_MASK);
if (!area) {
kmemleak_warn("kmemleak: Cannot allocate a scan area\n");
goto out;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists