ANDROID: vendor_hooks:vendor hook for mmput

add vendor hook in mmput while mm_users decreased to 0.

Bug: 238821038
Change-Id: I42a717cbeeb3176bac14b4b2391fdb2366c972d3
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
This commit is contained in:
xiaofeng
2022-07-13 10:23:51 +08:00
committed by Treehugger Robot
parent 4a84a59cb8
commit 19b9be6d35
3 changed files with 7 additions and 1 deletions

View File

@@ -410,3 +410,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_memcg_scan_type);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pidfd_open); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_pidfd_open);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmput);

View File

@@ -455,6 +455,9 @@ DECLARE_HOOK(android_vh_pidfd_open,
TP_PROTO(struct pid *p), TP_PROTO(struct pid *p),
TP_ARGS(p)); TP_ARGS(p));
DECLARE_HOOK(android_vh_mmput,
TP_PROTO(void *unused),
TP_ARGS(unused));
/* macro versions of hooks are no longer required */ /* macro versions of hooks are no longer required */
#endif /* _TRACE_HOOK_SCHED_H */ #endif /* _TRACE_HOOK_SCHED_H */

View File

@@ -1159,8 +1159,10 @@ void mmput(struct mm_struct *mm)
{ {
might_sleep(); might_sleep();
if (atomic_dec_and_test(&mm->mm_users)) if (atomic_dec_and_test(&mm->mm_users)) {
trace_android_vh_mmput(NULL);
__mmput(mm); __mmput(mm);
}
} }
EXPORT_SYMBOL_GPL(mmput); EXPORT_SYMBOL_GPL(mmput);