ANDROID: vendor_hooks: Add hooks for exiting control

Add hooks at process exiting routines so that oems
can control these procedures. One possible benifit is the peak of
system load can be shaved and load can be more smooth when a large
number of threads is killed once upon a time, while a sudden peak
of system load can probably lead to user junk issues.

Bug: 296493318
Change-Id: Ied4cc968e45baa39f1b79e8c7dce75cf6b8db55d
Signed-off-by: Qixia Yang <yangqixia2@oppo.com>
This commit is contained in:
Qixia Yang
2025-03-24 17:17:44 +08:00
parent 2e2c24358d
commit dc524f0ad6
3 changed files with 8 additions and 0 deletions
+1
View File
@@ -422,3 +422,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_reclaim_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_pages_failure_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_save_vmalloc_stack);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_stack_hash);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check);
+5
View File
@@ -130,6 +130,11 @@ DECLARE_HOOK(android_vh_record_rwsem_lock_starttime,
DECLARE_HOOK(android_vh_record_pcpu_rwsem_starttime,
TP_PROTO(struct percpu_rw_semaphore *sem, unsigned long settime_jiffies),
TP_ARGS(sem, settime_jiffies));
DECLARE_HOOK(android_vh_exit_check,
TP_PROTO(struct task_struct *p),
TP_ARGS(p));
#endif /* _TRACE_HOOK_DTASK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
+2
View File
@@ -75,6 +75,7 @@
#include <asm/unistd.h>
#include <asm/mmu_context.h>
#include <trace/hooks/dtask.h>
#include <trace/hooks/mm.h>
#include "exit.h"
@@ -897,6 +898,7 @@ void __noreturn do_exit(long code)
io_uring_files_cancel();
exit_signals(tsk); /* sets PF_EXITING */
trace_android_vh_exit_check(current);
seccomp_filter_release(tsk);