From 102a0743326a03cd1a1202ceda21e175b7d3575c Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Tue, 20 Feb 2024 01:20:52 +0000 Subject: [PATCH] add new system file --- kernel/kernel/freezer.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/kernel/kernel/freezer.c b/kernel/kernel/freezer.c index b162b74..203bf9c 100644 --- a/kernel/kernel/freezer.c +++ b/kernel/kernel/freezer.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * kernel/freezer.c - Function to freeze a process * @@ -10,6 +11,10 @@ #include <linux/syscalls.h> #include <linux/freezer.h> #include <linux/kthread.h> +#include <linux/mmu_context.h> + +#undef CREATE_TRACE_POINT +#include <trace/hooks/cgroup.h> /* total number of freezing conditions in effect */ atomic_t system_freezing_cnt = ATOMIC_INIT(0); @@ -20,12 +25,6 @@ */ bool pm_freezing; bool pm_nosig_freezing; - -/* - * Temporary export for the deadlock workaround in ata_scsi_hotplug(). - * Remove once the hack becomes unnecessary. - */ -EXPORT_SYMBOL_GPL(pm_freezing); /* protects freezing and frozen transitions */ static DEFINE_SPINLOCK(freezer_lock); @@ -75,6 +74,7 @@ if (!freezing(current) || (check_kthr_stop && kthread_should_stop())) current->flags &= ~PF_FROZEN; + trace_android_rvh_refrigerator(pm_nosig_freezing); spin_unlock_irq(&freezer_lock); if (!(current->flags & PF_FROZEN)) @@ -151,9 +151,16 @@ void __thaw_task(struct task_struct *p) { unsigned long flags; + const struct cpumask *mask = task_cpu_possible_mask(p); spin_lock_irqsave(&freezer_lock, flags); - if (frozen(p)) + /* + * Wake up frozen tasks. On asymmetric systems where tasks cannot + * run on all CPUs, ttwu() may have deferred a wakeup generated + * before thaw_secondary_cpus() had completed so we generate + * additional wakeups here for tasks in the PF_FREEZER_SKIP state. + */ + if (frozen(p) || (frozen_or_skipped(p) && mask != cpu_possible_mask)) wake_up_process(p); spin_unlock_irqrestore(&freezer_lock, flags); } -- Gitblit v1.6.2