Steven Rostedt ff7ee93f47 cgroup/kmemleak: Annotate alloc_page() for cgroup allocations
When the cgroup base was allocated with kmalloc, it was necessary to
annotate the variable with kmemleak_not_leak().  But because it has
recently been changed to be allocated with alloc_page() (which skips
kmemleak checks) causes a warning on boot up.

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.

If alloc_page() fails then it defaults back to vmalloc() which still uses
the kmemleak_alloc() which makes us still need the kmemleak_not_leak()
call.  The solution is to call the kmemleak_alloc() directly if the
alloc_page() succeeds.

Reviewed-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-11-02 16:06:59 -07:00
..
2011-07-25 20:57:14 -07:00
2011-05-26 09:20:31 -07:00
2011-10-31 17:30:49 -07:00
2011-07-25 20:57:09 -07:00
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-11-02 16:06:57 -07:00
2011-10-31 17:30:47 -07:00
2011-07-26 16:49:47 -07:00
2011-07-20 20:47:46 -04:00
2011-10-31 17:30:44 -07:00
2011-10-31 17:30:50 -07:00
2011-11-02 16:06:57 -07:00
2011-10-31 17:30:50 -07:00
2009-09-22 07:17:35 -07:00
2010-03-24 16:31:21 -07:00
2011-01-13 17:32:46 -08:00
2010-05-21 18:31:21 -04:00
2011-10-31 17:30:48 -07:00
2011-03-10 08:52:27 +01:00
2011-07-25 20:57:09 -07:00
2011-05-20 12:50:29 -07:00
2011-10-31 17:30:44 -07:00
2011-07-26 16:49:47 -07:00
2011-10-31 17:30:47 -07:00
2011-07-25 20:57:07 -07:00
2011-03-10 08:52:07 +01:00
2011-11-02 16:06:57 -07:00
2011-10-31 17:30:50 -07:00
2011-05-25 08:39:05 -07:00
2011-10-31 17:30:51 -07:00