lkml.org 
[lkml]   [2013]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid'
On 2013/5/7 18:46, Chen Gang wrote:
> Hello Maintainers:
>
> After call get_new_cssid(), I can not find the related free function
> (it seems free_css_id() is for that, but not used).
>
> The memory location is:
> get_new_cssid() --> kzalloc() for 'struct css_id'
> get_new_cssid() --> idr_alloc() for 'ss->idr'
>
> One work flow:
> cgroup_load_subsys() --> cgroup_init_idr() --> get_new_cssid()
> when get_new_cssid() fails, it will:
> cgroup_load_subsys() --> cgroup_unload_subsys() --> idr_destroy(),
> and also:
> cgroup_load_subsys() --> cgroup_unload_subsys() --> ss->css_free();
> ('css_free' may 'debug_css_free', or 'freezer_css_free' ...)
>
> It seems the work flow above is not 'kfree' 'struct css_id', is it true?
>
> BTW: I also guess, for cgroup_init_idr() in cgroup_init(), need check
> the return value.
>
> Please help check.
>

It's the specific cgroup subsystem that calls free_css_id() in it's subsys->css_free()
callback. See __mem_cgroup_free() for example.

There's a bug in cgroup_unload_subsys() that idr_destroy() should be called after
ss->css_free(). That said, given there's no modular cgroup subsystem using css_id,
and the whole css_id thing will be eliminated in 3.11, why bother fixing it.



\
 
 \ /
  Last update: 2013-05-07 13:41    [W:0.070 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site