Skip to content

Commit 8e4ec90

Browse files
htejunrafaeljw
authored andcommitted
freezer: Clarify that only cgroup1 freezer uses PM freezer
cgroup1 freezer piggybacks on the PM freezer, which inadvertently allowed userspace to produce uninterruptible tasks at will. To avoid the issue, cgroup2 freezer switched to a separate job control based mechanism. While this happened a long time ago, the code and comment haven't been updated making it confusing to people who aren't familiar with the history. Rename cgroup_freezing() to cgroup1_freezing() and update comments on top of freezing() and frozen() to clarify that cgroup2 freezer isn't covered by the PM freezer mechanism. Signed-off-by: Tejun Heo <tj@kernel.org> Suggested-by: Qu Wenruo <wqu@suse.com> Link: https://patch.msgid.link/aPZ3q6Hm865NicBC@slm.duckdns.org Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent ea35806 commit 8e4ec90

3 files changed

Lines changed: 10 additions & 6 deletions

File tree

include/linux/freezer.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,18 @@ extern bool pm_nosig_freezing; /* PM nosig freezing in effect */
2222
extern unsigned int freeze_timeout_msecs;
2323

2424
/*
25-
* Check if a process has been frozen
25+
* Check if a process has been frozen for PM or cgroup1 freezer. Note that
26+
* cgroup2 freezer uses the job control mechanism and does not interact with
27+
* the PM freezer.
2628
*/
2729
extern bool frozen(struct task_struct *p);
2830

2931
extern bool freezing_slow_path(struct task_struct *p);
3032

3133
/*
32-
* Check if there is a request to freeze a process
34+
* Check if there is a request to freeze a task from PM or cgroup1 freezer.
35+
* Note that cgroup2 freezer uses the job control mechanism and does not
36+
* interact with the PM freezer.
3337
*/
3438
static inline bool freezing(struct task_struct *p)
3539
{
@@ -63,9 +67,9 @@ extern bool freeze_task(struct task_struct *p);
6367
extern bool set_freezable(void);
6468

6569
#ifdef CONFIG_CGROUP_FREEZER
66-
extern bool cgroup_freezing(struct task_struct *task);
70+
extern bool cgroup1_freezing(struct task_struct *task);
6771
#else /* !CONFIG_CGROUP_FREEZER */
68-
static inline bool cgroup_freezing(struct task_struct *task)
72+
static inline bool cgroup1_freezing(struct task_struct *task)
6973
{
7074
return false;
7175
}

kernel/cgroup/legacy_freezer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static struct freezer *parent_freezer(struct freezer *freezer)
6363
return css_freezer(freezer->css.parent);
6464
}
6565

66-
bool cgroup_freezing(struct task_struct *task)
66+
bool cgroup1_freezing(struct task_struct *task)
6767
{
6868
bool ret;
6969

kernel/freezer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ bool freezing_slow_path(struct task_struct *p)
4444
if (tsk_is_oom_victim(p))
4545
return false;
4646

47-
if (pm_nosig_freezing || cgroup_freezing(p))
47+
if (pm_nosig_freezing || cgroup1_freezing(p))
4848
return true;
4949

5050
if (pm_freezing && !(p->flags & PF_KTHREAD))

0 commit comments

Comments
 (0)