+void __init enable_pressure_cgroup(void) +{
- WARN_ON(cgroup_add_cftypes(&mem_cgroup_subsys,
vmpressure_cgroup_files));
+}
There is no functionality discovery going on here, and this is conditional on nothing. Isn't it better then to just add the register + read functions to memcontrol.c and add the files in the memcontrol cftype ?
I was trying to make the stuff similar to the existing CONFIG_MEMCG_SWAP code, which does this kind of adding files to the cgroup. But I can surely place files into memcontrol cftype as you suggest.
Thanks a lot for the comments!
Note that swap can be command line disabled, and in that case we won't register the files.
Then it makes sense to do it in a separate helper. If I understand your code correctly, once it is compiled in, it will always be enabled. So I personally think it is clearer if you register it together with the rest of the crew.