Skip to content

CGroup Namespaces

Aditya Kali cgroups containers linux-api lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest8 patches 58 repliesIn review
  2. v27 patches 42 repliesSuperseded
  3. v18 patches 51 repliesSuperseded

Changes in v3 from the cover letter

1. Added documentation in Documentation/cgroups/namespace.txt
2. Fixed a bug that caused crash
3. Incorporated some other suggestions from last patchset:
- removed use of threadgroup_lock() while creating new cgroupns
- use task_lock() instead of rcu_read_lock() while accessing

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8kernfs: Add API to generate relative kernfs pathfs/kernfs/dir.c include/linux/kernfs.h+177 -210 replies
2/8sched: new clone flag CLONE_NEWCGROUP for cgroup namespaceinclude/uapi/linux/sched.h+1 -20 replies
3/8cgroup: add function to get task's cgroup on default hierarchyinclude/linux/cgroup.h kernel/cgroup.c+26 -00 replies
4/8cgroup: export cgroup_get() and cgroup_put()include/linux/cgroup.h kernel/cgroup.c+22 -220 replies
5/8cgroup: introduce cgroup namespacesfs/proc/namespaces.c include/linux/cgroup.h include/linux/cgroup_namespace.h +7 more+230 -51 reply
6/8cgroup: cgroup namespace setns supportkernel/cgroup_namespace.c+15 -20 replies
7/8cgroup: mount cgroupns-root when inside non-init cgroupnsfs/kernfs/mount.c include/linux/kernfs.h kernel/cgroup.c+95 -11 reply
8/8cgroup: Add documentation for cgroup namespacesDocumentation/cgroups/namespace.txt+147 -054 replies

Reviews trailers per patch

3 of 8 patches have a Reviewed-by or Acked-by.

PatchSerge Hallyn
1/8
2/8A-b
3/8A-b
4/8A-b
5/8
6/8
7/8
8/8

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCHv3 0/8] CGroup Namespaces

Another spin for CGroup Namespaces feature.

Changes from V2:
1. Added documentation in Documentation/cgroups/namespace.txt
2. Fixed a bug that caused crash
3. Incorporated some other suggestions from last patchset:
- removed use of threadgroup_lock() while creating new cgroupns
- use task_lock() instead of rcu_read_lock() while accessing

     task->nsproxy

- optimized setns() to own cgroupns
- simplified code around sane-behavior mount option parsing
4. Restored ACKs from Serge Hallyn from v1 on few patches that have not changed since then.

Changes from V1:
1. No pinning of processes within cgroupns. Tasks can be freely moved across cgroups even outside of their cgroupns-root. Usual DAC/MAC policies apply as before.
2. Path in /proc/<pid>/cgroup is now always shown and is relative to cgroupns-root. So path can contain '/..' strings depending on cgroupns-root of the reader and cgroup of <pid>.
3. setns() does not require the process to first move under target cgroupns-root.

Changes form RFC (V0):
1. setns support for cgroupns
2. 'mount -t cgroup cgroup <mntpt>' from inside a cgroupns now mounts the cgroup hierarcy with cgroupns-root as the filesystem root.
3. writes to cgroup files outside of cgroupns-root are not allowed
4. visibility of /proc/<pid>/cgroup is further restricted by not showing anything if the <pid> is in a sibling cgroupns and its cgroup falls outside your cgroupns-root.

---
 Documentation/cgroups/namespace.txt | 147 +++++++++++++++++++++++++++
 fs/kernfs/dir.c                     | 195 ++++++++++++++++++++++++++++++++----
 fs/kernfs/mount.c                   |  48 +++++++++
 fs/proc/namespaces.c                |   1 +
 include/linux/cgroup.h              |  52 +++++++++-
 include/linux/cgroup_namespace.h    |  36 +++++++
 include/linux/kernfs.h              |   5 +
 include/linux/nsproxy.h             |   2 +
 include/linux/proc_ns.h             |   4 +
 include/uapi/linux/sched.h          |   3 +-
 kernel/Makefile                     |   2 +-
 kernel/cgroup.c                     | 106 +++++++++++++++-----
 kernel/cgroup_namespace.c           | 140 ++++++++++++++++++++++++++
 kernel/fork.c                       |   2 +-
 kernel/nsproxy.c                    |  19 +++-
 15 files changed, 711 insertions(+), 51 deletions(-)
 create mode 100644 Documentation/cgroups/namespace.txt
 create mode 100644 include/linux/cgroup_namespace.h
 create mode 100644 kernel/cgroup_namespace.c

[PATCHv3 1/8] kernfs: Add API to generate relative kernfs path [PATCHv3 2/8] sched: new clone flag CLONE_NEWCGROUP for cgroup [PATCHv3 3/8] cgroup: add function to get task's cgroup on default [PATCHv3 4/8] cgroup: export cgroup_get() and cgroup_put() [PATCHv3 5/8] cgroup: introduce cgroup namespaces
[PATCHv3 6/8] cgroup: cgroup namespace setns support [PATCHv3 7/8] cgroup: mount cgroupns-root when inside non-init cgroupns [PATCHv3 8/8] cgroup: Add documentation for cgroup namespaces