.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * kernel/freezer.c - Function to freeze a process |
---|
3 | 4 | * |
---|
.. | .. |
---|
10 | 11 | #include <linux/syscalls.h> |
---|
11 | 12 | #include <linux/freezer.h> |
---|
12 | 13 | #include <linux/kthread.h> |
---|
| 14 | +#include <linux/mmu_context.h> |
---|
| 15 | + |
---|
| 16 | +#undef CREATE_TRACE_POINT |
---|
| 17 | +#include <trace/hooks/cgroup.h> |
---|
13 | 18 | |
---|
14 | 19 | /* total number of freezing conditions in effect */ |
---|
15 | 20 | atomic_t system_freezing_cnt = ATOMIC_INIT(0); |
---|
.. | .. |
---|
20 | 25 | */ |
---|
21 | 26 | bool pm_freezing; |
---|
22 | 27 | 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); |
---|
29 | 28 | |
---|
30 | 29 | /* protects freezing and frozen transitions */ |
---|
31 | 30 | static DEFINE_SPINLOCK(freezer_lock); |
---|
.. | .. |
---|
75 | 74 | if (!freezing(current) || |
---|
76 | 75 | (check_kthr_stop && kthread_should_stop())) |
---|
77 | 76 | current->flags &= ~PF_FROZEN; |
---|
| 77 | + trace_android_rvh_refrigerator(pm_nosig_freezing); |
---|
78 | 78 | spin_unlock_irq(&freezer_lock); |
---|
79 | 79 | |
---|
80 | 80 | if (!(current->flags & PF_FROZEN)) |
---|
.. | .. |
---|
151 | 151 | void __thaw_task(struct task_struct *p) |
---|
152 | 152 | { |
---|
153 | 153 | unsigned long flags; |
---|
| 154 | + const struct cpumask *mask = task_cpu_possible_mask(p); |
---|
154 | 155 | |
---|
155 | 156 | 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)) |
---|
157 | 164 | wake_up_process(p); |
---|
158 | 165 | spin_unlock_irqrestore(&freezer_lock, flags); |
---|
159 | 166 | } |
---|