* [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid'
@ 2013-05-07 10:46 Chen Gang
[not found] ` <5188DB93.2080504-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang @ 2013-05-07 10:46 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A, Li Zefan
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
cgroups-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
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.
Thanks.
--
Chen Gang
Asianux Corporation
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <5188DB93.2080504-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>]
* Re: [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid' [not found] ` <5188DB93.2080504-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org> @ 2013-05-07 11:01 ` Li Zefan [not found] ` <5188DF27.4080000-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Li Zefan @ 2013-05-07 11:01 UTC (permalink / raw) To: Chen Gang Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org 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. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <5188DF27.4080000-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid' [not found] ` <5188DF27.4080000-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> @ 2013-05-07 11:20 ` Chen Gang [not found] ` <5188E391.6040505-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Chen Gang @ 2013-05-07 11:20 UTC (permalink / raw) To: Li Zefan Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, cgroups-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 2013年05月07日 19:01, Li Zefan wrote: > 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. > OK, thank you for your confirmation. > 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. > I just find it by reading code (I also want to learn about kernel). I guess, for some stable versions, may focus on it, they are the different branches from the latest version. So, is it suitable to send related patch for the bug ? Thanks. -- Chen Gang Asianux Corporation ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <5188E391.6040505-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>]
* Re: [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid' [not found] ` <5188E391.6040505-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org> @ 2013-05-08 0:50 ` Li Zefan [not found] ` <5189A166.9080301-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 5+ messages in thread From: Li Zefan @ 2013-05-08 0:50 UTC (permalink / raw) To: Chen Gang Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org >> 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. >> > > I just find it by reading code (I also want to learn about kernel). > > I guess, for some stable versions, may focus on it, they are the > different branches from the latest version. > > So, is it suitable to send related patch for the bug ? > As I said, there's no modular cgroup subsystem using css_id, so the bug doesn't exist in real world. ^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <5189A166.9080301-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid' [not found] ` <5189A166.9080301-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> @ 2013-05-08 2:00 ` Chen Gang 0 siblings, 0 replies; 5+ messages in thread From: Chen Gang @ 2013-05-08 2:00 UTC (permalink / raw) To: Li Zefan Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On 2013年05月08日 08:50, Li Zefan wrote: >>> 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. >>> >> >> > >> > I just find it by reading code (I also want to learn about kernel). >> > >> > I guess, for some stable versions, may focus on it, they are the >> > different branches from the latest version. >> > >> > So, is it suitable to send related patch for the bug ? >> > > As I said, there's no modular cgroup subsystem using css_id, so the bug > doesn't exist in real world. > > > Excuse me, my English is not quite well, I guess what you said is: a. idr_destroy() should be called after ss->css_free() b. need check the return value of cgroup_init_idr() in cgroup_init(). but all features which related with the 2 issues above, never be used in any main linux main branches. so, the 2 bugs doesn't exist in real world. Is what I guess correct ? Thanks. -- Chen Gang Asianux Corporation _______________________________________________ Containers mailing list Containers@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/containers ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-05-08 2:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-07 10:46 [Suggestion] kernel/cgroup.c: about kfree after 'get_new_cssid' Chen Gang
[not found] ` <5188DB93.2080504-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-05-07 11:01 ` Li Zefan
[not found] ` <5188DF27.4080000-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-05-07 11:20 ` Chen Gang
[not found] ` <5188E391.6040505-bOixZGp5f+dBDgjK7y7TUQ@public.gmane.org>
2013-05-08 0:50 ` Li Zefan
[not found] ` <5189A166.9080301-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2013-05-08 2:00 ` Chen Gang
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox