Skip to content

Commit 2873cd3

Browse files
committed
exit: Remove profile_handoff_task
All profile_handoff_task does is notify the task_free_notifier chain. The helpers task_handoff_register and task_handoff_unregister are used to add and delete entries from that chain and are never called. So remove the dead code and make it much easier to read and reason about __put_task_struct. Suggested-by: Al Viro <viro@zeniv.linux.org.uk> Link: https://lkml.kernel.org/r/87fspyw6m0.fsf@email.froward.int.ebiederm.org Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent 2d4bcf8 commit 2873cd3

3 files changed

Lines changed: 1 addition & 45 deletions

File tree

include/linux/profile.h

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,6 @@ static inline void profile_hit(int type, void *ip)
6161
struct task_struct;
6262
struct mm_struct;
6363

64-
/* task is dead, free task struct ? Returns 1 if
65-
* the task was taken, 0 if the task should be freed.
66-
*/
67-
int profile_handoff_task(struct task_struct * task);
68-
69-
int task_handoff_register(struct notifier_block * n);
70-
int task_handoff_unregister(struct notifier_block * n);
71-
7264
#else
7365

7466
#define prof_on 0
@@ -93,17 +85,6 @@ static inline void profile_hit(int type, void *ip)
9385
return;
9486
}
9587

96-
static inline int task_handoff_register(struct notifier_block * n)
97-
{
98-
return -ENOSYS;
99-
}
100-
101-
static inline int task_handoff_unregister(struct notifier_block * n)
102-
{
103-
return -ENOSYS;
104-
}
105-
106-
#define profile_handoff_task(a) (0)
10788

10889
#endif /* CONFIG_PROFILING */
10990

kernel/fork.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -754,9 +754,7 @@ void __put_task_struct(struct task_struct *tsk)
754754
delayacct_tsk_free(tsk);
755755
put_signal_struct(tsk->signal);
756756
sched_core_free(tsk);
757-
758-
if (!profile_handoff_task(tsk))
759-
free_task(tsk);
757+
free_task(tsk);
760758
}
761759
EXPORT_SYMBOL_GPL(__put_task_struct);
762760

kernel/profile.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -133,29 +133,6 @@ int __ref profile_init(void)
133133
return -ENOMEM;
134134
}
135135

136-
/* Profile event notifications */
137-
138-
static ATOMIC_NOTIFIER_HEAD(task_free_notifier);
139-
140-
int profile_handoff_task(struct task_struct *task)
141-
{
142-
int ret;
143-
ret = atomic_notifier_call_chain(&task_free_notifier, 0, task);
144-
return (ret == NOTIFY_OK) ? 1 : 0;
145-
}
146-
147-
int task_handoff_register(struct notifier_block *n)
148-
{
149-
return atomic_notifier_chain_register(&task_free_notifier, n);
150-
}
151-
EXPORT_SYMBOL_GPL(task_handoff_register);
152-
153-
int task_handoff_unregister(struct notifier_block *n)
154-
{
155-
return atomic_notifier_chain_unregister(&task_free_notifier, n);
156-
}
157-
EXPORT_SYMBOL_GPL(task_handoff_unregister);
158-
159136
#if defined(CONFIG_SMP) && defined(CONFIG_PROC_FS)
160137
/*
161138
* Each cpu has a pair of open-addressed hashtables for pending

0 commit comments

Comments
 (0)