This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
Best regards, Ridong
commit ee09694849a570cbc32015b5329b7c2f3f778748 Author: Chen Ridong chenridong@huawei.com Date: Thu Jul 17 08:55:50 2025 +0000
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
[ Upstream commit 14a67b42cb6f3ab66f41603c062c5056d32ea7dd ] This reverts commit cff5f49d433fcd0063c8be7dd08fa5bf190c6c37. Commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") modified the cgroup_freezing() logic to verify that the FROZEN flag is not set, affecting the return value of the freezing() function, in order to address a warning in __thaw_task. A race condition exists that may allow tasks to escape being frozen. The following scenario demonstrates this issue: CPU 0 (get_signal path) CPU 1 (freezer.state reader) try_to_freeze read freezer.state __refrigerator freezer_read update_if_frozen WRITE_ONCE(current->__state, TASK_FROZEN); ... /* Task is now marked frozen */ /* frozen(task) == true */ /* Assuming other tasks are frozen */ freezer->state |= CGROUP_FROZEN; /* freezing(current) returns false */ /* because cgroup is frozen (not freezing) */ break out __set_current_state(TASK_RUNNING); /* Bug: Task resumes running when it should remain frozen */ The existing !frozen(p) check in __thaw_task makes the WARN_ON_ONCE(freezing(p)) warning redundant. Removing this warning enables reverting the commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") to resolve the issue. The warning has been removed in the previous patch. This patch revert the commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") to complete the fix. Fixes: cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") Reported-by: Zhong Jiaweizhongjiawei1@huawei.com Signed-off-by: Chen Ridong chenridong@huawei.com Signed-off-by: Tejun Heo tj@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org
diff --git a/kernel/cgroup/legacy_freezer.c b/kernel/cgroup/legacy_freezer.c index 507b8f19a262e..dd9417425d929 100644 --- a/kernel/cgroup/legacy_freezer.c +++ b/kernel/cgroup/legacy_freezer.c @@ -66,15 +66,9 @@ static struct freezer *parent_freezer(struct freezer *freezer) bool cgroup_freezing(struct task_struct *task) { bool ret;
- unsigned int state;
rcu_read_lock();
- /* Check if the cgroup is still FREEZING, but not FROZEN. The extra
* !FROZEN check is required, because the FREEZING bit is not cleared
* when the state FROZEN is reached.
*/
- state = task_freezer(task)->state;
- ret = (state & CGROUP_FREEZING) && !(state & CGROUP_FROZEN);
- ret = task_freezer(task)->state & CGROUP_FREEZING; rcu_read_unlock();
return ret;
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, Ridong
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Best regards, Ridong
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
This is a note to let you know that I've just added the patch titled
Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"
to the 6.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su...
The filename of the patch is: revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch and it can be found in the queue-6.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it.
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote:
> This is a note to let you know that I've just added the patch titled > > Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" > > to the 6.15-stable tree which can be found at: > http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... > > The filename of the patch is: > revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch > and it can be found in the queue-6.15 subdirectory. > > If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >
The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags); - if (WARN_ON_ONCE(freezing(p))) + if (!frozen(p)) goto unlock;
if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Best regards, Ridong
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote:
On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: > >> This is a note to let you know that I've just added the patch titled >> >> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >> >> to the 6.15-stable tree which can be found at: >> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >> >> The filename of the patch is: >> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >> and it can be found in the queue-6.15 subdirectory. >> >> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >> > > The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to > prevent triggering another warning in __thaw_task().
What is the git commit id of that change in Linus's tree?
thanks,
greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
From: Chen Ridong chenridong@huawei.com
To fix the [1] issue, it needs to backport: 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") 14a67b42cb6f ("Revert 'cgroup_freezer: cgroup freezing: Check if not...'").
This series aims to backport 9beb8c5e77dc. To avoid conflicts, backport the missing patches[2].
[1] https://lore.kernel.org/lkml/20250717085550.3828781-1-chenridong@huaweicloud... [2] https://lore.kernel.org/stable/2025072421-deviate-skintight-bbd5@gregkh/
Chen Ridong (1): sched,freezer: Remove unnecessary warning in __thaw_task
Elliot Berman (4): sched/core: Remove ifdeffery for saved_state freezer,sched: Use saved_state to reduce some spurious wakeups freezer,sched: Do not restore saved_state of a thawed task freezer,sched: Clean saved_state when restoring it during thaw
include/linux/sched.h | 2 -- kernel/freezer.c | 51 +++++++++++++++++-------------------------- kernel/sched/core.c | 31 +++++++++++++------------- 3 files changed, 35 insertions(+), 49 deletions(-)
From: Elliot Berman quic_eberman@quicinc.com
[ Upstream commit fbaa6a181a4b1886cbf4214abdf9a2df68471510 ]
In preparation for freezer to also use saved_state, remove the CONFIG_PREEMPT_RT compilation guard around saved_state.
On the arm64 platform I tested which did not have CONFIG_PREEMPT_RT, there was no statistically significant deviation by applying this patch.
Test methodology:
perf bench sched message -g 40 -l 40
Signed-off-by: Elliot Berman quic_eberman@quicinc.com Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org Signed-off-by: Ingo Molnar mingo@kernel.org Signed-off-by: Chen Ridong chenridong@huawei.com --- include/linux/sched.h | 2 -- kernel/sched/core.c | 10 ++-------- 2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h index 393c300347de..cb38eee732fd 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -753,10 +753,8 @@ struct task_struct { #endif unsigned int __state;
-#ifdef CONFIG_PREEMPT_RT /* saved state for "spinlock sleepers" */ unsigned int saved_state; -#endif
/* * This begins the randomizable portion of task_struct. Only diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 760a6c3781cb..ab6550fadecd 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2238,17 +2238,15 @@ int __task_state_match(struct task_struct *p, unsigned int state) if (READ_ONCE(p->__state) & state) return 1;
-#ifdef CONFIG_PREEMPT_RT if (READ_ONCE(p->saved_state) & state) return -1; -#endif + return 0; }
static __always_inline int task_state_match(struct task_struct *p, unsigned int state) { -#ifdef CONFIG_PREEMPT_RT int match;
/* @@ -2260,9 +2258,6 @@ int task_state_match(struct task_struct *p, unsigned int state) raw_spin_unlock_irq(&p->pi_lock);
return match; -#else - return __task_state_match(p, state); -#endif }
/* @@ -4059,7 +4054,6 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
*success = !!(match = __task_state_match(p, state));
-#ifdef CONFIG_PREEMPT_RT /* * Saved state preserves the task state across blocking on * an RT lock. If the state matches, set p::saved_state to @@ -4075,7 +4069,7 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) */ if (match < 0) p->saved_state = TASK_RUNNING; -#endif + return match > 0; }
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues: ❌ Build failures detected
The upstream commit SHA1 provided is correct: fbaa6a181a4b1886cbf4214abdf9a2df68471510
WARNING: Author mismatch between patch and upstream commit: Backport author: Chen Ridong chenridong@huaweicloud.com Commit author: Elliot Berman quic_eberman@quicinc.com
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1)
Note: The patch differs from the upstream commit: --- 1: fbaa6a181a4b ! 1: b72e2a437525 sched/core: Remove ifdeffery for saved_state @@ Metadata ## Commit message ## sched/core: Remove ifdeffery for saved_state
+ [ Upstream commit fbaa6a181a4b1886cbf4214abdf9a2df68471510 ] + In preparation for freezer to also use saved_state, remove the CONFIG_PREEMPT_RT compilation guard around saved_state.
@@ Commit message Signed-off-by: Elliot Berman quic_eberman@quicinc.com Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org Signed-off-by: Ingo Molnar mingo@kernel.org + Signed-off-by: Chen Ridong chenridong@huawei.com
## include/linux/sched.h ## @@ include/linux/sched.h: struct task_struct { @@ kernel/sched/core.c: int __task_state_match(struct task_struct *p, unsigned int int task_state_match(struct task_struct *p, unsigned int state) { -#ifdef CONFIG_PREEMPT_RT + int match; + /* - * Serialize against current_save_and_set_rtlock_wait_state() and - * current_restore_rtlock_saved_state(). - */ - guard(raw_spinlock_irq)(&p->pi_lock); +@@ kernel/sched/core.c: int task_state_match(struct task_struct *p, unsigned int state) + raw_spin_unlock_irq(&p->pi_lock); + + return match; +-#else +- return __task_state_match(p, state); -#endif - return __task_state_match(p, state); }
+ /* @@ kernel/sched/core.c: bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
*success = !!(match = __task_state_match(p, state));
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 6.6 | Success | Failed |
From: Elliot Berman quic_eberman@quicinc.com
[ Upstream commit 8f0eed4a78a81668bc78923ea09f51a7a663c2b0 ]
After commit f5d39b020809 ("freezer,sched: Rewrite core freezer logic"), tasks that transition directly from TASK_FREEZABLE to TASK_FROZEN are always woken up on the thaw path. Prior to that commit, tasks could ask freezer to consider them "frozen enough" via freezer_do_not_count(). The commit replaced freezer_do_not_count() with a TASK_FREEZABLE state which allows freezer to immediately mark the task as TASK_FROZEN without waking up the task. This is efficient for the suspend path, but on the thaw path, the task is always woken up even if the task didn't need to wake up and goes back to its TASK_(UN)INTERRUPTIBLE state. Although these tasks are capable of handling of the wakeup, we can observe a power/perf impact from the extra wakeup.
We observed on Android many tasks wait in the TASK_FREEZABLE state (particularly due to many of them being binder clients). We observed nearly 4x the number of tasks and a corresponding linear increase in latency and power consumption when thawing the system. The latency increased from ~15ms to ~50ms.
Avoid the spurious wakeups by saving the state of TASK_FREEZABLE tasks. If the task was running before entering TASK_FROZEN state (__refrigerator()) or if the task received a wake up for the saved state, then the task is woken on thaw. saved_state from PREEMPT_RT locks can be re-used because freezer would not stomp on the rtlock wait flow: TASK_RTLOCK_WAIT isn't considered freezable.
Reported-by: Prakash Viswalingam quic_prakashv@quicinc.com Signed-off-by: Elliot Berman quic_eberman@quicinc.com Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org Signed-off-by: Ingo Molnar mingo@kernel.org Signed-off-by: Chen Ridong chenridong@huawei.com --- kernel/freezer.c | 41 +++++++++++++++++++---------------------- kernel/sched/core.c | 21 +++++++++++++-------- 2 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..c450fa8b8b5e 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -71,7 +71,11 @@ bool __refrigerator(bool check_kthr_stop) for (;;) { bool freeze;
+ raw_spin_lock_irq(¤t->pi_lock); set_current_state(TASK_FROZEN); + /* unstale saved_state so that __thaw_task() will wake us up */ + current->saved_state = TASK_RUNNING; + raw_spin_unlock_irq(¤t->pi_lock);
spin_lock_irq(&freezer_lock); freeze = freezing(current) && !(check_kthr_stop && kthread_should_stop()); @@ -129,6 +133,7 @@ static int __set_task_frozen(struct task_struct *p, void *arg) WARN_ON_ONCE(debug_locks && p->lockdep_depth); #endif
+ p->saved_state = p->__state; WRITE_ONCE(p->__state, TASK_FROZEN); return TASK_FROZEN; } @@ -170,42 +175,34 @@ bool freeze_task(struct task_struct *p) }
/* - * The special task states (TASK_STOPPED, TASK_TRACED) keep their canonical - * state in p->jobctl. If either of them got a wakeup that was missed because - * TASK_FROZEN, then their canonical state reflects that and the below will - * refuse to restore the special state and instead issue the wakeup. + * Restore the saved_state before the task entered freezer. For typical task + * in the __refrigerator(), saved_state == TASK_RUNNING so nothing happens + * here. For tasks which were TASK_NORMAL | TASK_FREEZABLE, their initial state + * is restored unless they got an expected wakeup (see ttwu_state_match()). + * Returns 1 if the task state was restored. */ -static int __set_task_special(struct task_struct *p, void *arg) +static int __restore_freezer_state(struct task_struct *p, void *arg) { - unsigned int state = 0; + unsigned int state = p->saved_state;
- if (p->jobctl & JOBCTL_TRACED) - state = TASK_TRACED; - - else if (p->jobctl & JOBCTL_STOPPED) - state = TASK_STOPPED; - - if (state) + if (state != TASK_RUNNING) { WRITE_ONCE(p->__state, state); + return 1; + }
- return state; + return 0; }
void __thaw_task(struct task_struct *p) { - unsigned long flags, flags2; + unsigned long flags;
spin_lock_irqsave(&freezer_lock, flags); if (WARN_ON_ONCE(freezing(p))) goto unlock;
- if (lock_task_sighand(p, &flags2)) { - /* TASK_FROZEN -> TASK_{STOPPED,TRACED} */ - bool ret = task_call_func(p, __set_task_special, NULL); - unlock_task_sighand(p, &flags2); - if (ret) - goto unlock; - } + if (task_call_func(p, __restore_freezer_state, NULL)) + goto unlock;
wake_up_state(p, TASK_FROZEN); unlock: diff --git a/kernel/sched/core.c b/kernel/sched/core.c index ab6550fadecd..1b5e4389f788 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2251,7 +2251,7 @@ int task_state_match(struct task_struct *p, unsigned int state)
/* * Serialize against current_save_and_set_rtlock_wait_state() and - * current_restore_rtlock_saved_state(). + * current_restore_rtlock_saved_state(), and __refrigerator(). */ raw_spin_lock_irq(&p->pi_lock); match = __task_state_match(p, state); @@ -4034,13 +4034,17 @@ static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags) * The caller holds p::pi_lock if p != current or has preemption * disabled when p == current. * - * The rules of PREEMPT_RT saved_state: + * The rules of saved_state: * * The related locking code always holds p::pi_lock when updating * p::saved_state, which means the code is fully serialized in both cases. * - * The lock wait and lock wakeups happen via TASK_RTLOCK_WAIT. No other - * bits set. This allows to distinguish all wakeup scenarios. + * For PREEMPT_RT, the lock wait and lock wakeups happen via TASK_RTLOCK_WAIT. + * No other bits set. This allows to distinguish all wakeup scenarios. + * + * For FREEZER, the wakeup happens via TASK_FROZEN. No other bits set. This + * allows us to prevent early wakeup of tasks before they can be run on + * asymmetric ISA architectures (eg ARMv9). */ static __always_inline bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success) @@ -4056,10 +4060,11 @@ bool ttwu_state_match(struct task_struct *p, unsigned int state, int *success)
/* * Saved state preserves the task state across blocking on - * an RT lock. If the state matches, set p::saved_state to - * TASK_RUNNING, but do not wake the task because it waits - * for a lock wakeup. Also indicate success because from - * the regular waker's point of view this has succeeded. + * an RT lock or TASK_FREEZABLE tasks. If the state matches, + * set p::saved_state to TASK_RUNNING, but do not wake the task + * because it waits for a lock wakeup or __thaw_task(). Also + * indicate success because from the regular waker's point of + * view this has succeeded. * * After acquiring the lock the task will restore p::__state * from p::saved_state which ensures that the regular
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues: ℹ️ This is part 2/5 of a series ⚠️ Found follow-up fixes in mainline
The upstream commit SHA1 provided is correct: 8f0eed4a78a81668bc78923ea09f51a7a663c2b0
WARNING: Author mismatch between patch and upstream commit: Backport author: Chen Ridong chenridong@huaweicloud.com Commit author: Elliot Berman quic_eberman@quicinc.com
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1)
Found fixes commits: 23ab79e8e469 freezer,sched: Do not restore saved_state of a thawed task
Note: Could not generate a diff with upstream commit: --- Note: Could not generate diff - patch failed to apply for comparison ---
NOTE: These results are for this patch alone. Full series testing will be performed when all parts are received.
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 6.6 | Success | Success |
From: Elliot Berman quic_eberman@quicinc.com
[ Upstream commit 23ab79e8e469e2605beec2e3ccb40d19c68dd2e0 ]
It is possible for a task to be thawed multiple times when mixing the *legacy* cgroup freezer and system-wide freezer. To do this, freeze the cgroup, do system-wide freeze/thaw, then thaw the cgroup. When this happens, then a stale saved_state can be written to the task's state and cause task to hang indefinitely. Fix this by only trying to thaw tasks that are actually frozen.
This change also has the marginal benefit avoiding unnecessary wake_up_state(p, TASK_FROZEN) if we know the task is already thawed. There is not possibility of time-of-compare/time-of-use race when we skip the wake_up_state because entering/exiting TASK_FROZEN is guarded by freezer_lock.
Fixes: 8f0eed4a78a8 ("freezer,sched: Use saved_state to reduce some spurious wakeups") Signed-off-by: Elliot Berman quic_eberman@quicinc.com Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org Reviewed-by: Abhijeet Dharmapurikar quic_adharmap@quicinc.com Link: https://lore.kernel.org/r/20231120-freezer-state-multiple-thaws-v1-1-f2e1dd7... Signed-off-by: Chen Ridong chenridong@huawei.com --- kernel/freezer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/freezer.c b/kernel/freezer.c index c450fa8b8b5e..759006a9a910 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -201,7 +201,7 @@ void __thaw_task(struct task_struct *p) if (WARN_ON_ONCE(freezing(p))) goto unlock;
- if (task_call_func(p, __restore_freezer_state, NULL)) + if (!frozen(p) || task_call_func(p, __restore_freezer_state, NULL)) goto unlock;
wake_up_state(p, TASK_FROZEN);
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 23ab79e8e469e2605beec2e3ccb40d19c68dd2e0
WARNING: Author mismatch between patch and upstream commit: Backport author: Chen Ridong chenridong@huaweicloud.com Commit author: Elliot Berman quic_eberman@quicinc.com
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1)
Note: Could not generate a diff with upstream commit: --- Note: Could not generate diff - patch failed to apply for comparison ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 6.6 | Success | Success |
From: Elliot Berman quic_eberman@quicinc.com
[ Upstream commit 418146e39891ef1fb2284dee4cabbfe616cd21cf ]
Clean saved_state after using it during thaw. Cleaning the saved_state allows us to avoid some unnecessary branches in ttwu_state_match.
Signed-off-by: Elliot Berman quic_eberman@quicinc.com Signed-off-by: Peter Zijlstra (Intel) peterz@infradead.org Link: https://lore.kernel.org/r/20231120-freezer-state-multiple-thaws-v1-2-f2e1dd7... Signed-off-by: Chen Ridong chenridong@huawei.com --- kernel/freezer.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/kernel/freezer.c b/kernel/freezer.c index 759006a9a910..f57aaf96b829 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -187,6 +187,7 @@ static int __restore_freezer_state(struct task_struct *p, void *arg)
if (state != TASK_RUNNING) { WRITE_ONCE(p->__state, state); + p->saved_state = TASK_RUNNING; return 1; }
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 418146e39891ef1fb2284dee4cabbfe616cd21cf
WARNING: Author mismatch between patch and upstream commit: Backport author: Chen Ridong chenridong@huaweicloud.com Commit author: Elliot Berman quic_eberman@quicinc.com
Status in newer kernel trees: 6.15.y | Present (exact SHA1) 6.12.y | Present (exact SHA1)
Note: Could not generate a diff with upstream commit: --- Note: Could not generate diff - patch failed to apply for comparison ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 6.6 | Success | Success |
From: Chen Ridong chenridong@huawei.com
[ Upstream commit 9beb8c5e77dc10e3889ff5f967eeffba78617a88 ]
Commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") modified the cgroup_freezing() logic to verify that the FROZEN flag is not set, affecting the return value of the freezing() function, in order to address a warning in __thaw_task.
A race condition exists that may allow tasks to escape being frozen. The following scenario demonstrates this issue:
CPU 0 (get_signal path) CPU 1 (freezer.state reader) try_to_freeze read freezer.state __refrigerator freezer_read update_if_frozen WRITE_ONCE(current->__state, TASK_FROZEN); ... /* Task is now marked frozen */ /* frozen(task) == true */ /* Assuming other tasks are frozen */ freezer->state |= CGROUP_FROZEN; /* freezing(current) returns false */ /* because cgroup is frozen (not freezing) */ break out __set_current_state(TASK_RUNNING); /* Bug: Task resumes running when it should remain frozen */
The existing !frozen(p) check in __thaw_task makes the WARN_ON_ONCE(freezing(p)) warning redundant. Removing this warning enables reverting commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") to resolve the issue.
This patch removes the warning from __thaw_task. A subsequent patch will revert commit cff5f49d433f ("cgroup_freezer: cgroup_freezing: Check if not frozen") to complete the fix.
Reported-by: Zhong Jiaweizhongjiawei1@huawei.com Signed-off-by: Chen Ridong chenridong@huawei.com Signed-off-by: Tejun Heo tj@kernel.org --- kernel/freezer.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
diff --git a/kernel/freezer.c b/kernel/freezer.c index f57aaf96b829..d8db479af478 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,18 +196,9 @@ static int __restore_freezer_state(struct task_struct *p, void *arg)
void __thaw_task(struct task_struct *p) { - unsigned long flags; - - spin_lock_irqsave(&freezer_lock, flags); - if (WARN_ON_ONCE(freezing(p))) - goto unlock; - - if (!frozen(p) || task_call_func(p, __restore_freezer_state, NULL)) - goto unlock; - - wake_up_state(p, TASK_FROZEN); -unlock: - spin_unlock_irqrestore(&freezer_lock, flags); + guard(spinlock_irqsave)(&freezer_lock); + if (frozen(p) && !task_call_func(p, __restore_freezer_state, NULL)) + wake_up_state(p, TASK_FROZEN); }
/**
[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: 9beb8c5e77dc10e3889ff5f967eeffba78617a88
WARNING: Author mismatch between patch and upstream commit: Backport author: Chen Ridong chenridong@huaweicloud.com Commit author: Chen Ridong chenridong@huawei.com
Status in newer kernel trees: 6.15.y | Not found 6.12.y | Not found
Note: Could not generate a diff with upstream commit: --- Note: Could not generate diff - patch failed to apply for comparison ---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | 6.6 | Success | Success |
On 2025/7/24 17:43, Greg KH wrote:
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote:
On 2025/7/22 20:18, Greg KH wrote: > On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: >> >>> This is a note to let you know that I've just added the patch titled >>> >>> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >>> >>> to the 6.15-stable tree which can be found at: >>> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >>> >>> The filename of the patch is: >>> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >>> and it can be found in the queue-6.15 subdirectory. >>> >>> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >>> >> >> The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to >> prevent triggering another warning in __thaw_task(). > > What is the git commit id of that change in Linus's tree? > > thanks, > > greg k-h
9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
Hi Greg and maintainers,
I've sent the patch series for 6.6.y. Backporting commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") requires 4 patches for 6.6.y, and the backport to 6.1.y would be even more complex.
As an alternative, I'm considering addressing the warning directly with the patch I mentioned previously. What are your thoughts on this approach?
The new patch:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags); - if (WARN_ON_ONCE(freezing(p))) + if (!frozen(p)) goto unlock;
if (lock_task_sighand(p, &flags2)) {
Best regards, Ridong
On Tue, Jul 29, 2025 at 09:22:10PM +0800, Chen Ridong wrote:
On 2025/7/24 17:43, Greg KH wrote:
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote:
On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote: > > > On 2025/7/22 20:18, Greg KH wrote: >> On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: >>> >>>> This is a note to let you know that I've just added the patch titled >>>> >>>> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >>>> >>>> to the 6.15-stable tree which can be found at: >>>> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >>>> >>>> The filename of the patch is: >>>> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >>>> and it can be found in the queue-6.15 subdirectory. >>>> >>>> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >>>> >>> >>> The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to >>> prevent triggering another warning in __thaw_task(). >> >> What is the git commit id of that change in Linus's tree? >> >> thanks, >> >> greg k-h > > 9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task")
Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go there as that's what this revert was applied back to.
greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
Hi Greg and maintainers,
I've sent the patch series for 6.6.y. Backporting commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") requires 4 patches for 6.6.y, and the backport to 6.1.y would be even more complex.
As an alternative, I'm considering addressing the warning directly with the patch I mentioned previously. What are your thoughts on this approach?
The new patch:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
I have no idea, sorry, please work with the developers/maintainers of the original change and get their approval. But normally, we do NOT want one-off changes being made to older kernel trees unless it has to be done, as that makes maintaining them much much much harder over time.
thanks,
greg k-h
On 2025/7/29 22:33, Greg KH wrote:
On Tue, Jul 29, 2025 at 09:22:10PM +0800, Chen Ridong wrote:
On 2025/7/24 17:43, Greg KH wrote:
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote:
On 2025/7/22 20:38, Greg KH wrote: > On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote: >> >> >> On 2025/7/22 20:18, Greg KH wrote: >>> On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: >>>> >>>>> This is a note to let you know that I've just added the patch titled >>>>> >>>>> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >>>>> >>>>> to the 6.15-stable tree which can be found at: >>>>> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >>>>> >>>>> The filename of the patch is: >>>>> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >>>>> and it can be found in the queue-6.15 subdirectory. >>>>> >>>>> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >>>>> >>>> >>>> The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to >>>> prevent triggering another warning in __thaw_task(). >>> >>> What is the git commit id of that change in Linus's tree? >>> >>> thanks, >>> >>> greg k-h >> >> 9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task") > > Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go > there as that's what this revert was applied back to. > > greg k-h
Hi Greg,
The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
Hi Greg and maintainers,
I've sent the patch series for 6.6.y. Backporting commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") requires 4 patches for 6.6.y, and the backport to 6.1.y would be even more complex.
As an alternative, I'm considering addressing the warning directly with the patch I mentioned previously. What are your thoughts on this approach?
The new patch:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
I have no idea, sorry, please work with the developers/maintainers of the original change and get their approval. But normally, we do NOT want one-off changes being made to older kernel trees unless it has to be done, as that makes maintaining them much much much harder over time.
thanks,
greg k-h
Hi, developers/maintainers,
Could you please review this series for 6.6.y?
Best regards, Ridong
On Thu, Jul 31, 2025 at 08:01:17PM +0800, Chen Ridong wrote:
On 2025/7/29 22:33, Greg KH wrote:
On Tue, Jul 29, 2025 at 09:22:10PM +0800, Chen Ridong wrote:
On 2025/7/24 17:43, Greg KH wrote:
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote:
On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote: > > > On 2025/7/22 20:38, Greg KH wrote: >> On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote: >>> >>> >>> On 2025/7/22 20:18, Greg KH wrote: >>>> On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: >>>>> >>>>>> This is a note to let you know that I've just added the patch titled >>>>>> >>>>>> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >>>>>> >>>>>> to the 6.15-stable tree which can be found at: >>>>>> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >>>>>> >>>>>> The filename of the patch is: >>>>>> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >>>>>> and it can be found in the queue-6.15 subdirectory. >>>>>> >>>>>> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >>>>>> >>>>> >>>>> The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to >>>>> prevent triggering another warning in __thaw_task(). >>>> >>>> What is the git commit id of that change in Linus's tree? >>>> >>>> thanks, >>>> >>>> greg k-h >>> >>> 9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task") >> >> Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go >> there as that's what this revert was applied back to. >> >> greg k-h > > Hi Greg, > > The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together > with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the > warning for 6.1.y or 6.6.y.
Ok, but 9beb8c5e77dc does not apply properly there. Can you please provide a working backport?
thanks,
greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
Hi Greg and maintainers,
I've sent the patch series for 6.6.y. Backporting commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") requires 4 patches for 6.6.y, and the backport to 6.1.y would be even more complex.
As an alternative, I'm considering addressing the warning directly with the patch I mentioned previously. What are your thoughts on this approach?
The new patch:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
I have no idea, sorry, please work with the developers/maintainers of the original change and get their approval. But normally, we do NOT want one-off changes being made to older kernel trees unless it has to be done, as that makes maintaining them much much much harder over time.
thanks,
greg k-h
Hi, developers/maintainers,
Could you please review this series for 6.6.y?
What "this series" are you responding to? This email subject says 6.15? Please submit the patches, properly backported, in a form that you have tested and wish to have reviewed, otherwise we have no idea of what to do here.
Remember, some of us get 1000+ emails a day, context matters :)
thanks,
greg k-h
On 2025/7/31 20:13, Greg KH wrote:
On Thu, Jul 31, 2025 at 08:01:17PM +0800, Chen Ridong wrote:
On 2025/7/29 22:33, Greg KH wrote:
On Tue, Jul 29, 2025 at 09:22:10PM +0800, Chen Ridong wrote:
On 2025/7/24 17:43, Greg KH wrote:
On Thu, Jul 24, 2025 at 05:38:52PM +0800, Chen Ridong wrote:
On 2025/7/23 13:06, Greg KH wrote: > On Wed, Jul 23, 2025 at 09:01:43AM +0800, Chen Ridong wrote: >> >> >> On 2025/7/22 20:38, Greg KH wrote: >>> On Tue, Jul 22, 2025 at 08:25:49PM +0800, Chen Ridong wrote: >>>> >>>> >>>> On 2025/7/22 20:18, Greg KH wrote: >>>>> On Tue, Jul 22, 2025 at 09:29:13AM +0800, Chen Ridong wrote: >>>>>> >>>>>>> This is a note to let you know that I've just added the patch titled >>>>>>> >>>>>>> Revert "cgroup_freezer: cgroup_freezing: Check if not frozen" >>>>>>> >>>>>>> to the 6.15-stable tree which can be found at: >>>>>>> http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git%3Ba=su... >>>>>>> >>>>>>> The filename of the patch is: >>>>>>> revert-cgroup_freezer-cgroup_freezing-check-if-not-f.patch >>>>>>> and it can be found in the queue-6.15 subdirectory. >>>>>>> >>>>>>> If you, or anyone else, feels it should not be added to the stable tree, please let stable@vger.kernel.org know about it. >>>>>>> >>>>>> >>>>>> The patch ("sched,freezer: Remove unnecessary warning in __thaw_task") should also be merged to >>>>>> prevent triggering another warning in __thaw_task(). >>>>> >>>>> What is the git commit id of that change in Linus's tree? >>>>> >>>>> thanks, >>>>> >>>>> greg k-h >>>> >>>> 9beb8c5e77dc10e3889ff5f967eeffba78617a88 ("sched,freezer: Remove unnecessary warning in __thaw_task") >>> >>> Thanks, but that didn't apply to 6.1.y or 6.6.y. Shouldn't it also go >>> there as that's what this revert was applied back to. >>> >>> greg k-h >> >> Hi Greg, >> >> The commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") should be merged together >> with 14a67b42cb6f ("Revert "cgroup_freezer: cgroup_freezing: Check if not frozen"") to avoid the >> warning for 6.1.y or 6.6.y. > > Ok, but 9beb8c5e77dc does not apply properly there. Can you please > provide a working backport? > > thanks, > > greg k-h
IIUC, we need to backport these two commits together: 1.commit 23ab79e8e469 ("freezer,sched: Do not restore saved_state of a thawed task") 2.commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...").
After applying these prerequisites, the required change becomes minimal:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
Would you like me to prepare and submit this patch for the stable branches (6.6.y and 6.1.y)?
Yes, please send me the missing patches as a series for each branch that needs them.
thanks,
greg k-h
Hi Greg and maintainers,
I've sent the patch series for 6.6.y. Backporting commit 9beb8c5e77dc ("sched,freezer: Remove unnecessary warning...") requires 4 patches for 6.6.y, and the backport to 6.1.y would be even more complex.
As an alternative, I'm considering addressing the warning directly with the patch I mentioned previously. What are your thoughts on this approach?
The new patch:
diff --git a/kernel/freezer.c b/kernel/freezer.c index 4fad0e6fca64..288d1cce1fc4 100644 --- a/kernel/freezer.c +++ b/kernel/freezer.c @@ -196,7 +196,7 @@ void __thaw_task(struct task_struct *p) unsigned long flags, flags2;
spin_lock_irqsave(&freezer_lock, flags);
if (WARN_ON_ONCE(freezing(p)))
if (!frozen(p)) goto unlock; if (lock_task_sighand(p, &flags2)) {
I have no idea, sorry, please work with the developers/maintainers of the original change and get their approval. But normally, we do NOT want one-off changes being made to older kernel trees unless it has to be done, as that makes maintaining them much much much harder over time.
thanks,
greg k-h
Hi, developers/maintainers,
Could you please review this series for 6.6.y?
What "this series" are you responding to? This email subject says 6.15? Please submit the patches, properly backported, in a form that you have tested and wish to have reviewed, otherwise we have no idea of what to do here.
Remember, some of us get 1000+ emails a day, context matters :)
thanks,
greg k-h
Thanks, greg.
See, I will resend the series for 6.6.y.
Best regards, Ridong
linux-stable-mirror@lists.linaro.org