Revert "exit: Remove profile_task_exit & profile_munmap"
This reverts commit2d4bcf886e
, which removed hooks required for Android uid_sys_stats.c. Bug: 219790626 Change-Id: Icea00bbf9abe2fb17312b25f2d575d29aa360999 [nkapron: resolve conflict with2873cd31a2
exit: Remove profile_handoff_task] Signed-off-by: Neill Kapron <nkapron@google.com>
This commit is contained in:
parent
3ff04317e4
commit
bd772a54d2
@ -31,6 +31,11 @@ static inline int create_proc_profile(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
enum profile_type {
|
||||
PROFILE_TASK_EXIT,
|
||||
PROFILE_MUNMAP
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PROFILING
|
||||
|
||||
extern int prof_on __read_mostly;
|
||||
@ -61,6 +66,15 @@ static inline void profile_hit(int type, void *ip)
|
||||
struct task_struct;
|
||||
struct mm_struct;
|
||||
|
||||
/* task is in do_exit() */
|
||||
void profile_task_exit(struct task_struct * task);
|
||||
|
||||
/* sys_munmap */
|
||||
void profile_munmap(unsigned long addr);
|
||||
|
||||
int profile_event_register(enum profile_type, struct notifier_block * n);
|
||||
int profile_event_unregister(enum profile_type, struct notifier_block * n);
|
||||
|
||||
#else
|
||||
|
||||
#define prof_on 0
|
||||
@ -85,6 +99,18 @@ static inline void profile_hit(int type, void *ip)
|
||||
return;
|
||||
}
|
||||
|
||||
static inline int profile_event_register(enum profile_type t, struct notifier_block * n)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static inline int profile_event_unregister(enum profile_type t, struct notifier_block * n)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
#define profile_task_exit(a) do { } while (0)
|
||||
#define profile_munmap(a) do { } while (0)
|
||||
|
||||
#endif /* CONFIG_PROFILING */
|
||||
|
||||
|
@ -811,6 +811,7 @@ void __noreturn do_exit(long code)
|
||||
|
||||
WARN_ON(tsk->plug);
|
||||
|
||||
profile_task_exit(tsk);
|
||||
kcov_task_exit(tsk);
|
||||
kmsan_task_exit(tsk);
|
||||
|
||||
|
@ -136,6 +136,59 @@ int __ref profile_init(void)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
/* Profile event notifications */
|
||||
|
||||
static BLOCKING_NOTIFIER_HEAD(task_exit_notifier);
|
||||
static BLOCKING_NOTIFIER_HEAD(munmap_notifier);
|
||||
|
||||
void profile_task_exit(struct task_struct *task)
|
||||
{
|
||||
blocking_notifier_call_chain(&task_exit_notifier, 0, task);
|
||||
}
|
||||
|
||||
void profile_munmap(unsigned long addr)
|
||||
{
|
||||
blocking_notifier_call_chain(&munmap_notifier, 0, (void *)addr);
|
||||
}
|
||||
|
||||
int profile_event_register(enum profile_type type, struct notifier_block *n)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
|
||||
switch (type) {
|
||||
case PROFILE_TASK_EXIT:
|
||||
err = blocking_notifier_chain_register(
|
||||
&task_exit_notifier, n);
|
||||
break;
|
||||
case PROFILE_MUNMAP:
|
||||
err = blocking_notifier_chain_register(
|
||||
&munmap_notifier, n);
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(profile_event_register);
|
||||
|
||||
int profile_event_unregister(enum profile_type type, struct notifier_block *n)
|
||||
{
|
||||
int err = -EINVAL;
|
||||
|
||||
switch (type) {
|
||||
case PROFILE_TASK_EXIT:
|
||||
err = blocking_notifier_chain_unregister(
|
||||
&task_exit_notifier, n);
|
||||
break;
|
||||
case PROFILE_MUNMAP:
|
||||
err = blocking_notifier_chain_unregister(
|
||||
&munmap_notifier, n);
|
||||
break;
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(profile_event_unregister);
|
||||
|
||||
#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
|
||||
/*
|
||||
* Each cpu has a pair of open-addressed hashtables for pending
|
||||
|
Loading…
Reference in New Issue
Block a user