]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
freezer,sched: Clean saved_state when restoring it during thaw
authorElliot Berman <quic_eberman@quicinc.com>
Mon, 20 Nov 2023 17:36:32 +0000 (09:36 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:09:07 +0000 (12:09 +0200)
commit 418146e39891ef1fb2284dee4cabbfe616cd21cf upstream.

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-f2e1dd7ce5a2@quicinc.com
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/freezer.c

index 759006a9a91026a99d3a5022e605a94eea73a6a5..f57aaf96b8291cfea5c9e7174e011df6463a926a 100644 (file)
@@ -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;
        }