0005-cgroup-Add-mount-flag-to-enable-cpuset-to-use-v2-beh.patch 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. From f33ce8d7dcb3053b513003fb775d6457d30d4921 Mon Sep 17 00:00:00 2001
  2. From: Waiman Long <[email protected]>
  3. Date: Thu, 17 Aug 2017 15:33:09 -0400
  4. Subject: [PATCH 005/242] cgroup: Add mount flag to enable cpuset to use v2
  5. behavior in v1 cgroup
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. A new mount option "cpuset_v2_mode" is added to the v1 cgroupfs
  10. filesystem to enable cpuset controller to use v2 behavior in a v1
  11. cgroup. This mount option applies only to cpuset controller and have
  12. no effect on other controllers.
  13. Signed-off-by: Waiman Long <[email protected]>
  14. Signed-off-by: Tejun Heo <[email protected]>
  15. (cherry-picked from e1cba4b85daa71b710384d451ff6238d5e4d1ff6)
  16. Signed-off-by: Fabian Grünbichler <[email protected]>
  17. ---
  18. include/linux/cgroup-defs.h | 5 +++++
  19. kernel/cgroup/cgroup-v1.c | 6 ++++++
  20. 2 files changed, 11 insertions(+)
  21. diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
  22. index 09f4c7df1478..c344e77707a5 100644
  23. --- a/include/linux/cgroup-defs.h
  24. +++ b/include/linux/cgroup-defs.h
  25. @@ -74,6 +74,11 @@ enum {
  26. * aren't writeable from inside the namespace.
  27. */
  28. CGRP_ROOT_NS_DELEGATE = (1 << 3),
  29. +
  30. + /*
  31. + * Enable cpuset controller in v1 cgroup to use v2 behavior.
  32. + */
  33. + CGRP_ROOT_CPUSET_V2_MODE = (1 << 4),
  34. };
  35. /* cftype->flags */
  36. diff --git a/kernel/cgroup/cgroup-v1.c b/kernel/cgroup/cgroup-v1.c
  37. index 7bf4b1533f34..ce7426b875f5 100644
  38. --- a/kernel/cgroup/cgroup-v1.c
  39. +++ b/kernel/cgroup/cgroup-v1.c
  40. @@ -846,6 +846,8 @@ static int cgroup1_show_options(struct seq_file *seq, struct kernfs_root *kf_roo
  41. seq_puts(seq, ",noprefix");
  42. if (root->flags & CGRP_ROOT_XATTR)
  43. seq_puts(seq, ",xattr");
  44. + if (root->flags & CGRP_ROOT_CPUSET_V2_MODE)
  45. + seq_puts(seq, ",cpuset_v2_mode");
  46. spin_lock(&release_agent_path_lock);
  47. if (strlen(root->release_agent_path))
  48. @@ -900,6 +902,10 @@ static int parse_cgroupfs_options(char *data, struct cgroup_sb_opts *opts)
  49. opts->cpuset_clone_children = true;
  50. continue;
  51. }
  52. + if (!strcmp(token, "cpuset_v2_mode")) {
  53. + opts->flags |= CGRP_ROOT_CPUSET_V2_MODE;
  54. + continue;
  55. + }
  56. if (!strcmp(token, "xattr")) {
  57. opts->flags |= CGRP_ROOT_XATTR;
  58. continue;
  59. --
  60. 2.14.2