[PATCH v3 0/7] freezer for cgroup v2
From: Roman Gushchin
Date: Fri Nov 16 2018 - 19:38:38 EST
This patchset implements freezer for cgroup v2.
It provides similar functionality as v1 freezer, but the interface
conforms to the cgroup v2 interface design principles, and it
provides a better user experience: tasks can be killed, ptrace works,
there is no separate controller, which has to be enabled, etc.
Patches (1), (2) and (3) are some preparational work, patch (4) contains
the implementation, patch (5) is a small cgroup kselftest fix,
patch (6) covers freezer adds 6 new kselftests to cover the freezer
functionality. Patch (7) adds corresponding docs.
v3->v2:
- dropped TASK_FROZEN for now, frozen tasks are put into TASK_INTERRUPTIBLE
state; it's probably not the final version, but the API question can be
discussed separately
- don't clear TIF_SIGPENDING before going to sleep, instead add
task->frozen check in signal_pending_state() and recalc_sigpending()
- cgroup-level counter are now synchronized using css_set_lock,
which simplified the whole code (e.g. per-cgroup works were removed)
- the amount of comments increased significantly
- many other improvements incorporating feedback from Tejun and Oleg
v2->v1:
- fixed locking aroung calling cgroup_freezer_leave()
- added docs
Roman Gushchin (7):
cgroup: rename freezer.c into legacy_freezer.c
cgroup: implement __cgroup_task_count() helper
cgroup: protect cgroup->nr_(dying_)descendants by css_set_lock
cgroup: cgroup v2 freezer
kselftests: cgroup: don't fail on cg_kill_all() error in cg_destroy()
kselftests: cgroup: add freezer controller self-tests
cgroup: document cgroup v2 freezer interface
Documentation/admin-guide/cgroup-v2.rst | 26 +
include/linux/cgroup-defs.h | 31 +
include/linux/cgroup.h | 42 ++
include/linux/sched.h | 2 +
include/linux/sched/jobctl.h | 2 +
include/linux/sched/signal.h | 2 +
kernel/cgroup/Makefile | 4 +-
kernel/cgroup/cgroup-internal.h | 1 +
kernel/cgroup/cgroup-v1.c | 16 -
kernel/cgroup/cgroup.c | 165 ++++-
kernel/cgroup/freezer.c | 641 ++++++----------
kernel/cgroup/legacy_freezer.c | 481 ++++++++++++
kernel/ptrace.c | 7 +
kernel/signal.c | 57 +-
tools/testing/selftests/cgroup/.gitignore | 1 +
tools/testing/selftests/cgroup/Makefile | 2 +
tools/testing/selftests/cgroup/cgroup_util.c | 85 ++-
tools/testing/selftests/cgroup/cgroup_util.h | 7 +
tools/testing/selftests/cgroup/test_freezer.c | 685 ++++++++++++++++++
19 files changed, 1804 insertions(+), 453 deletions(-)
create mode 100644 kernel/cgroup/legacy_freezer.c
create mode 100644 tools/testing/selftests/cgroup/test_freezer.c
--
2.17.2