0061-config-Enable-CONFIG_MEMCG-but-leave-it-disabled-due.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. From 27950dc12923e0679a177ae7d17779a77d9500af Mon Sep 17 00:00:00 2001
  2. From: popcornmix <popcornmix@gmail.com>
  3. Date: Wed, 18 Dec 2013 22:16:19 +0000
  4. Subject: [PATCH 061/381] config: Enable CONFIG_MEMCG, but leave it disabled
  5. (due to memory cost). Enable with cgroup_enable=memory.
  6. ---
  7. kernel/cgroup.c | 23 ++++++++++++++++++++++-
  8. 1 file changed, 22 insertions(+), 1 deletion(-)
  9. --- a/kernel/cgroup.c
  10. +++ b/kernel/cgroup.c
  11. @@ -5306,7 +5306,7 @@ int __init cgroup_init_early(void)
  12. return 0;
  13. }
  14. -static unsigned long cgroup_disable_mask __initdata;
  15. +static unsigned long cgroup_disable_mask __initdata = 1<<0;
  16. /**
  17. * cgroup_init - cgroup initialization
  18. @@ -5802,6 +5802,27 @@ static int __init cgroup_disable(char *s
  19. }
  20. __setup("cgroup_disable=", cgroup_disable);
  21. +static int __init cgroup_enable(char *str)
  22. +{
  23. + struct cgroup_subsys *ss;
  24. + char *token;
  25. + int i;
  26. +
  27. + while ((token = strsep(&str, ",")) != NULL) {
  28. + if (!*token)
  29. + continue;
  30. +
  31. + for_each_subsys(ss, i) {
  32. + if (strcmp(token, ss->name) &&
  33. + strcmp(token, ss->legacy_name))
  34. + continue;
  35. + cgroup_disable_mask &= ~(1 << i);
  36. + }
  37. + }
  38. + return 1;
  39. +}
  40. +__setup("cgroup_enable=", cgroup_enable);
  41. +
  42. /**
  43. * css_tryget_online_from_dir - get corresponding css from a cgroup dentry
  44. * @dentry: directory dentry of interest