[PATCH] tracehooks: remove death_cookie from exit_notify() path
Oleg Nesterov
oleg at redhat.com
Wed Jul 29 00:15:40 UTC 2009
On 07/28, Roland McGrath wrote:
>
> > OK, I'll send the first patch upstream, then I re-send 2-4 with updated
> > comments to you.
>
> Ok, good. When I get those I'll merge those upstream-bound ones into the
> tracehook git branch (now just signals-tracehook_notify_jctl-change.patch)
> and merge the utrace changes into the utrace branch.
Since we are going to send some tracehook changes upstream, how about the
patch below as well?
I think it is very unlikely we will need death_cookie in the near future,
and it is always nice to simplify the code.
Oleg.
--------------------------------------------------------------------------
[PATCH] tracehooks: remove death_cookie from exit_notify() path
Remove "void *death_cookie" from exit_notify() pathes, it is not really
used.
--- __UTRACE/include/linux/utrace.h~KILL_COOKIE 2009-07-28 23:27:14.000000000 +0200
+++ __UTRACE/include/linux/utrace.h 2009-07-29 02:05:07.000000000 +0200
@@ -105,7 +105,7 @@ void utrace_finish_vfork(struct task_str
__attribute__((weak));
void utrace_report_exit(long *exit_code)
__attribute__((weak));
-void utrace_report_death(struct task_struct *, struct utrace *, bool, int)
+void utrace_report_death(struct task_struct *, bool, int)
__attribute__((weak));
void utrace_report_jctl(int notify, int type)
__attribute__((weak));
--- __UTRACE/include/linux/tracehook.h~KILL_COOKIE 2009-07-28 23:28:47.000000000 +0200
+++ __UTRACE/include/linux/tracehook.h 2009-07-29 02:04:42.000000000 +0200
@@ -538,7 +538,6 @@ static inline void tracehook_finish_jctl
/**
* tracehook_notify_death - task is dead, ready to notify parent
* @task: @current task now exiting
- * @death_cookie: value to pass to tracehook_report_death()
* @group_dead: nonzero if this was the last thread in the group to die
*
* A return value >= 0 means call do_notify_parent() with that signal
@@ -550,10 +549,8 @@ static inline void tracehook_finish_jctl
* Called with write_lock_irq(&tasklist_lock) held.
*/
static inline int tracehook_notify_death(struct task_struct *task,
- void **death_cookie, int group_dead)
+ int group_dead)
{
- *death_cookie = task_utrace_struct(task);
-
if (task_detached(task))
return task->ptrace ? SIGCHLD : DEATH_REAP;
@@ -572,14 +569,12 @@ static inline int tracehook_notify_death
* tracehook_report_death - task is dead and ready to be reaped
* @task: @current task now exiting
* @signal: return value from tracheook_notify_death()
- * @death_cookie: value passed back from tracehook_notify_death()
* @group_dead: nonzero if this was the last thread in the group to die
*
* Thread has just become a zombie or is about to self-reap. If positive,
* @signal is the signal number just sent to the parent (usually %SIGCHLD).
* If @signal is %DEATH_REAP, this thread will self-reap. If @signal is
* %DEATH_DELAYED_GROUP_LEADER, this is a delayed_group_leader() zombie.
- * The @death_cookie was passed back by tracehook_notify_death().
*
* If normal reaping is not inhibited, @task->exit_state might be changing
* in parallel.
@@ -587,8 +582,7 @@ static inline int tracehook_notify_death
* Called without locks.
*/
static inline void tracehook_report_death(struct task_struct *task,
- int signal, void *death_cookie,
- int group_dead)
+ int signal, int group_dead)
{
/*
* This barrier ensures that our caller's setting of
@@ -603,7 +597,7 @@ static inline void tracehook_report_deat
*/
smp_mb();
if (task_utrace_flags(task) & _UTRACE_DEATH_EVENTS)
- utrace_report_death(task, death_cookie, group_dead, signal);
+ utrace_report_death(task, group_dead, signal);
}
#ifdef TIF_NOTIFY_RESUME
--- __UTRACE/kernel/exit.c~KILL_COOKIE 2009-07-13 17:44:27.000000000 +0200
+++ __UTRACE/kernel/exit.c 2009-07-29 02:02:47.000000000 +0200
@@ -803,7 +803,6 @@ static void forget_original_parent(struc
static void exit_notify(struct task_struct *tsk, int group_dead)
{
int signal;
- void *cookie;
/*
* This does two things:
@@ -839,7 +838,7 @@ static void exit_notify(struct task_stru
tsk->self_exec_id != tsk->parent_exec_id))
tsk->exit_signal = SIGCHLD;
- signal = tracehook_notify_death(tsk, &cookie, group_dead);
+ signal = tracehook_notify_death(tsk, group_dead);
if (signal >= 0)
signal = do_notify_parent(tsk, signal);
@@ -853,7 +852,7 @@ static void exit_notify(struct task_stru
write_unlock_irq(&tasklist_lock);
- tracehook_report_death(tsk, signal, cookie, group_dead);
+ tracehook_report_death(tsk, signal, group_dead);
/* If the process is dead, release it - nobody will wait for it */
if (signal == DEATH_REAP)
--- __UTRACE/kernel/utrace.c~KILL_COOKIE 2009-07-29 00:14:42.000000000 +0200
+++ __UTRACE/kernel/utrace.c 2009-07-29 02:06:20.000000000 +0200
@@ -1659,9 +1659,9 @@ void utrace_report_exit(long *exit_code)
* For this reason, utrace_release_task checks for the event bits that get
* us here, and delays its cleanup for us to do.
*/
-void utrace_report_death(struct task_struct *task, struct utrace *utrace,
- bool group_dead, int signal)
+void utrace_report_death(struct task_struct *task, bool group_dead, int signal)
{
+ struct utrace *utrace = task_utrace_struct(task);
INIT_REPORT(report);
BUG_ON(!task->exit_state);
More information about the utrace-devel
mailing list