Skip to content

Commit

Permalink
cgroup: Add deprecation message to legacy freezer controller
Browse files Browse the repository at this point in the history
As explained in the commit 76f969e ("cgroup: cgroup v2 freezer"),
the original freezer is imperfect, some users may unwittingly rely on it
when there exists the alternative of v2. Print a message when it happens
and explain that in the docs.

Signed-off-by: Michal Koutný <mkoutny@suse.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Michal Koutný authored and Tejun Heo committed Mar 11, 2025
1 parent fd4fd0a commit 78f6519
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Documentation/admin-guide/cgroup-v1/freezer-subsystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,7 @@ to unfreeze all tasks in the container::

This is the basic mechanism which should do the right thing for user space task
in a simple scenario.

This freezer implementation is affected by shortcomings (see commit
76f969e8948d8 ("cgroup: cgroup v2 freezer")) and cgroup v2 freezer is
recommended.
6 changes: 4 additions & 2 deletions kernel/cgroup/legacy_freezer.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,11 @@ static ssize_t freezer_write(struct kernfs_open_file *of,

if (strcmp(buf, freezer_state_strs(0)) == 0)
freeze = false;
else if (strcmp(buf, freezer_state_strs(CGROUP_FROZEN)) == 0)
else if (strcmp(buf, freezer_state_strs(CGROUP_FROZEN)) == 0) {
pr_info_once("Freezing with imperfect legacy cgroup freezer. "
"See cgroup.freeze of cgroup v2\n");
freeze = true;
else
} else
return -EINVAL;

freezer_change_state(css_freezer(of_css(of)), freeze);
Expand Down

0 comments on commit 78f6519

Please sign in to comment.