[Devel] Re: [PATCH 3/4] provide a function to register more cftype files into memcg

Glauber Costa glommer at parallels.com
Wed Mar 21 00:27:12 PDT 2012


On 03/20/2012 10:32 PM, Tejun Heo wrote:
> Hey,
>
> On Tue, Mar 20, 2012 at 08:50:55PM +0400, Glauber Costa wrote:
>> The function mem_cgroup_register_cftype() is provided here, so
>> an optional memcg subsystem that needs to register files at
>> a time later than memcg initialization can do it.
>>
>> Signed-off-by: Glauber Costa<glommer at parallels.com>
>> CC: Tejun Heo<tj at kernel.org>
>> CC: Aneesh Kumar K.V<aneesh.kumar at linux.vnet.ibm.com>
>> ---
>>   include/linux/memcontrol.h |    1 +
>>   mm/memcontrol.c            |    6 ++++++
>>   2 files changed, 7 insertions(+), 0 deletions(-)
>>
>> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
>> index 4d34356..bcf8de3 100644
>> --- a/include/linux/memcontrol.h
>> +++ b/include/linux/memcontrol.h
>> @@ -141,6 +141,7 @@ static inline bool mem_cgroup_disabled(void)
>>   	return false;
>>   }
>>
>> +int mem_cgroup_register_cftype(const struct cftype *cfts);
>>   void mem_cgroup_update_page_stat(struct page *page,
>>   				 enum mem_cgroup_page_stat_item idx,
>>   				 int val);
>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>> index f7c6727..bd91a46 100644
>> --- a/mm/memcontrol.c
>> +++ b/mm/memcontrol.c
>> @@ -444,6 +444,12 @@ struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg)
>>   	return&memcg->css;
>>   }
>>
>> +int mem_cgroup_register_cftype(const struct cftype *cfts)
>> +{
>> +	return WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys, cfts));
>> +}
>> +EXPORT_SYMBOL(mem_cgroup_register_cftype);
>
> Why not just export mem_cgroup_subsys?
>

I'm fine either way. I usually prefer not exporting raw data like this, 
but that's 100 % taste. How do you prefer me to do it?





More information about the Devel mailing list