]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
freezer: Clarify that only cgroup1 freezer uses PM freezer
authorTejun Heo <tj@kernel.org>
Mon, 20 Oct 2025 17:55:55 +0000 (07:55 -1000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 30 Oct 2025 19:10:27 +0000 (20:10 +0100)
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>
include/linux/freezer.h
kernel/cgroup/legacy_freezer.c
kernel/freezer.c

index 32884c9721e5646fc1dcb9bfea54f382aef0b801..0a8c6c4d1a8293a10d1c2ac09d71e26c27e08af6 100644 (file)
@@ -22,14 +22,18 @@ extern bool pm_nosig_freezing;              /* PM nosig freezing in effect */
 extern unsigned int freeze_timeout_msecs;
 
 /*
- * Check if a process has been frozen
+ * Check if a process has been frozen for PM or cgroup1 freezer. Note that
+ * cgroup2 freezer uses the job control mechanism and does not interact with
+ * the PM freezer.
  */
 extern bool frozen(struct task_struct *p);
 
 extern bool freezing_slow_path(struct task_struct *p);
 
 /*
- * Check if there is a request to freeze a process
+ * Check if there is a request to freeze a task from PM or cgroup1 freezer.
+ * Note that cgroup2 freezer uses the job control mechanism and does not
+ * interact with the PM freezer.
  */
 static inline bool freezing(struct task_struct *p)
 {
@@ -63,9 +67,9 @@ extern bool freeze_task(struct task_struct *p);
 extern bool set_freezable(void);
 
 #ifdef CONFIG_CGROUP_FREEZER
-extern bool cgroup_freezing(struct task_struct *task);
+extern bool cgroup1_freezing(struct task_struct *task);
 #else /* !CONFIG_CGROUP_FREEZER */
-static inline bool cgroup_freezing(struct task_struct *task)
+static inline bool cgroup1_freezing(struct task_struct *task)
 {
        return false;
 }
index dd9417425d9292cf5f6801b16ed7ade2427b040d..915b02f65980942dc5b99ea74f23cc342533dabc 100644 (file)
@@ -63,7 +63,7 @@ static struct freezer *parent_freezer(struct freezer *freezer)
        return css_freezer(freezer->css.parent);
 }
 
-bool cgroup_freezing(struct task_struct *task)
+bool cgroup1_freezing(struct task_struct *task)
 {
        bool ret;
 
index ddc11a8bd2ea2e7fa3ecb6e612151da37066a18b..a76bf957fb32d56a9b30b5406e9d67955a388429 100644 (file)
@@ -44,7 +44,7 @@ bool freezing_slow_path(struct task_struct *p)
        if (tsk_is_oom_victim(p))
                return false;
 
-       if (pm_nosig_freezing || cgroup_freezing(p))
+       if (pm_nosig_freezing || cgroup1_freezing(p))
                return true;
 
        if (pm_freezing && !(p->flags & PF_KTHREAD))