Re: [RFC][PATCH] Reduce size of swap_cgroup by CSS ID
From: KAMEZAWA Hiroyuki
Date: Thu Feb 05 2009 - 08:27:21 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/