ANDROID: freezer: Add vendor hook to freezer for GKI purpose.

Add the vendor hook to freezer.c so that OEM's logic can be executed
when the process is about to be frozen. We need to clear the flag for
some tasks and rebind task dependencies for optimization purposes.

Bug: 425550656
Bug: 339371220
Bug: 187458531
Bug: 281920779

Signed-off-by: heshuai1 <heshuai1@xiaomi.com>
Change-Id: Iea42fd9604d6b33ccd6502425416f0dd28eecebb
(cherry picked from commit a1580311c36ca28344b2f03b3c8a72d9f8db5bde)
(cherry picked from commit 37c02e72fa457d525c185f357399f9ae766d34f9)
This commit is contained in:
heshuai1
2021-05-07 19:40:52 +08:00
committed by Treehugger Robot
parent 56508b8d26
commit 19151c7f81
3 changed files with 9 additions and 0 deletions

View File

@@ -78,6 +78,7 @@
* Export tracepoints that act as a bare tracehook (ie: have no trace event
* associated with them) to allow external modules to probe them.
*/
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_refrigerator);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_send_sig_info);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_killed_process);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_arch_set_freq_scale);

View File

@@ -15,6 +15,10 @@ DECLARE_HOOK(android_vh_cgroup_set_task,
TP_PROTO(int ret, struct cgroup *cgrp, struct task_struct *task, bool threadgroup),
TP_ARGS(ret, cgrp, task, threadgroup));
DECLARE_RESTRICTED_HOOK(android_rvh_refrigerator,
TP_PROTO(bool f),
TP_ARGS(f), 1);
DECLARE_HOOK(android_vh_cgroup_attach,
TP_PROTO(struct cgroup_subsys *ss, struct cgroup_taskset *tset),
TP_ARGS(ss, tset));

View File

@@ -12,6 +12,9 @@
#include <linux/freezer.h>
#include <linux/kthread.h>
#undef CREATE_TRACE_POINT
#include <trace/hooks/cgroup.h>
/* total number of freezing conditions in effect */
DEFINE_STATIC_KEY_FALSE(freezer_active);
EXPORT_SYMBOL(freezer_active);
@@ -79,6 +82,7 @@ bool __refrigerator(bool check_kthr_stop)
spin_lock_irq(&freezer_lock);
freeze = freezing(current) && !(check_kthr_stop && kthread_should_stop());
trace_android_rvh_refrigerator(pm_nosig_freezing);
spin_unlock_irq(&freezer_lock);
if (!freeze)