Messages in this thread | | | Date | Thu, 5 Feb 2009 22:27:02 +0900 (JST) | Subject | Re: [RFC][PATCH] Reduce size of swap_cgroup by CSS ID | From | "KAMEZAWA Hiroyuki" <> |
| |
Paul E. McKenney wrote: > On Thu, Feb 05, 2009 at 06:59:59PM +0900, KAMEZAWA Hiroyuki wrote:
>> +static struct mem_cgroup *mem_cgroup_lookup_get(unsigned short id) >> +{ >> + struct cgroup_subsys_state *css; >> + >> + /* ID 0 is unused ID */ >> + if (!id) >> + return NULL; >> + css = css_lookup(&mem_cgroup_subsys, id); >> + if (css && css_tryget(css)) >> + return container_of(css, struct mem_cgroup, css); > > So css_tryget(), if successful, prevents the structure referenced by > css from being freed, correct? (If not, the range of the RCU read-side > critical sections surrounding calls to mem_cgroup_lookup_get() must be > extended.) > One reference to css by css_tryget() prevents rmdir(). So, css will not be freed until css_put() is called.
Thanks, -Kame
| |