All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cgroup/kmemcheck: No need to annotate base anymore
@ 2011-07-26 17:05 Steven Rostedt
  2011-07-26 17:38 ` Michal Hocko
  0 siblings, 1 reply; 16+ messages in thread
From: Steven Rostedt @ 2011-07-26 17:05 UTC (permalink / raw)
  To: LKML
  Cc: Johannes Weiner, KAMEZAWA Hiroyuki, Daisuke Nishimura,
	Balbir Singh, Minchan Kim, Randy Dunlap, Andrew Morton,
	Michal Hocko, Dave Hansen

When the cgroup base was allocated with kmalloc, it was necessary to
annotate the variable with kmemcheck_not_leak(). But because it has
recently been changed to be allocated with alloc_page(), the annotation
is no longer needed.

I was triggering this output:

allocated 8388608 bytes of page_cgroup
please try 'cgroup_disable=memory' option if you don't want memory cgroups
kmemleak: Trying to color unknown object at 0xf5840000 as Grey
Pid: 0, comm: swapper Not tainted 3.0.0-test #12
Call Trace:
 [<c17e34e6>] ? printk+0x1d/0x1f^M
 [<c10e2941>] paint_ptr+0x4f/0x78
 [<c178ab57>] kmemleak_not_leak+0x58/0x7d
 [<c108ae9f>] ? __rcu_read_unlock+0x9/0x7d
 [<c1cdb462>] kmemleak_init+0x19d/0x1e9
 [<c1cbf771>] start_kernel+0x346/0x3ec
 [<c1cbf1b4>] ? loglevel+0x18/0x18
 [<c1cbf0aa>] i386_start_kernel+0xaa/0xb0

After a bit of debugging I tracked the object 0xf840000 (and others)
down to the cgroup code. The change from allocating base with kmalloc to
alloc_page() has the base not calling kmemleak_alloc() which adds the
pointer to the object_tree_root, but kmemleak_not_leak() adds it to the
crt_early_log[] table. On kmemleak_init(), the entry is found in the
early_log[] but not the object_tree_root, and this error message is
displayed.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/mm/page_cgroup.c b/mm/page_cgroup.c
index 53bffc6..955a49f 100644
--- a/mm/page_cgroup.c
+++ b/mm/page_cgroup.c
@@ -9,7 +9,6 @@
 #include <linux/vmalloc.h>
 #include <linux/cgroup.h>
 #include <linux/swapops.h>
-#include <linux/kmemleak.h>
 
 static void __meminit init_page_cgroup(struct page_cgroup *pc, unsigned long id)
 {
@@ -179,13 +178,6 @@ static int __meminit init_section_page_cgroup(unsigned long pfn, int nid)
 	table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION;
 	base = alloc_page_cgroup(table_size, nid);
 
-	/*
-	 * The value stored in section->page_cgroup is (base - pfn)
-	 * and it does not point to the memory block allocated above,
-	 * causing kmemleak false positives.
-	 */
-	kmemleak_not_leak(base);
-
 	if (!base) {
 		printk(KERN_ERR "page cgroup allocation failure\n");
 		return -ENOMEM;



^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2011-08-12 10:02 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26 17:05 [PATCH] cgroup/kmemcheck: No need to annotate base anymore Steven Rostedt
2011-07-26 17:38 ` Michal Hocko
2011-07-26 17:41   ` Steven Rostedt
2011-07-26 17:44     ` Steven Rostedt
2011-07-26 18:17       ` [PATCH v2] cgroup/kmemcheck: Annotate alloc_page() for cgroup allocations Steven Rostedt
2011-07-26 18:43         ` Michal Hocko
2011-07-26 19:04           ` Steven Rostedt
2011-07-26 19:19             ` [PATCH v3] " Steven Rostedt
2011-07-26 22:13               ` Johannes Weiner
2011-07-26 23:03               ` Minchan Kim
2011-07-27  0:55               ` KAMEZAWA Hiroyuki
2011-08-12  9:58               ` Catalin Marinas
     [not found]             ` <1311707088.21143.0.camel-f9ZlEuEWxVcI6MkJdU+c8EEOCMrvLtNR@public.gmane.org>
2011-07-27  2:10               ` [PATCH v3 RESEND] " Steven Rostedt
2011-07-27  2:10             ` Steven Rostedt
     [not found]               ` <1311732644.21143.5.camel-f9ZlEuEWxVcI6MkJdU+c8EEOCMrvLtNR@public.gmane.org>
2011-07-29 13:31                 ` Steven Rostedt
2011-07-29 13:31               ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.