hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/kernel/freezer.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * kernel/freezer.c - Function to freeze a process
34 *
....@@ -10,6 +11,10 @@
1011 #include <linux/syscalls.h>
1112 #include <linux/freezer.h>
1213 #include <linux/kthread.h>
14
+#include <linux/mmu_context.h>
15
+
16
+#undef CREATE_TRACE_POINT
17
+#include <trace/hooks/cgroup.h>
1318
1419 /* total number of freezing conditions in effect */
1520 atomic_t system_freezing_cnt = ATOMIC_INIT(0);
....@@ -20,12 +25,6 @@
2025 */
2126 bool pm_freezing;
2227 bool pm_nosig_freezing;
23
-
24
-/*
25
- * Temporary export for the deadlock workaround in ata_scsi_hotplug().
26
- * Remove once the hack becomes unnecessary.
27
- */
28
-EXPORT_SYMBOL_GPL(pm_freezing);
2928
3029 /* protects freezing and frozen transitions */
3130 static DEFINE_SPINLOCK(freezer_lock);
....@@ -75,6 +74,7 @@
7574 if (!freezing(current) ||
7675 (check_kthr_stop && kthread_should_stop()))
7776 current->flags &= ~PF_FROZEN;
77
+ trace_android_rvh_refrigerator(pm_nosig_freezing);
7878 spin_unlock_irq(&freezer_lock);
7979
8080 if (!(current->flags & PF_FROZEN))
....@@ -151,9 +151,16 @@
151151 void __thaw_task(struct task_struct *p)
152152 {
153153 unsigned long flags;
154
+ const struct cpumask *mask = task_cpu_possible_mask(p);
154155
155156 spin_lock_irqsave(&freezer_lock, flags);
156
- if (frozen(p))
157
+ /*
158
+ * Wake up frozen tasks. On asymmetric systems where tasks cannot
159
+ * run on all CPUs, ttwu() may have deferred a wakeup generated
160
+ * before thaw_secondary_cpus() had completed so we generate
161
+ * additional wakeups here for tasks in the PF_FREEZER_SKIP state.
162
+ */
163
+ if (frozen(p) || (frozen_or_skipped(p) && mask != cpu_possible_mask))
157164 wake_up_process(p);
158165 spin_unlock_irqrestore(&freezer_lock, flags);
159166 }