If I understand correctly death_cookie was needed before
"[PATCH] Embed struct utrace in task_struct - V2".

tracehook_report_death() could race with utrace_release_task() which
cleared ->utrace, that is why tracehook_notify_death() had to read
task_utrace_struct() in advance and then pass this argument to
utrace_report_death().

Looks like this is not needed any longer, kill this awful cookie.

Signed-off-by: Oleg Nesterov <o...@redhat.com>

--- xxx/include/linux/utrace.h~KILL_COOKIE      2009-03-03 18:11:47.000000000 
+0100
+++ xxx/include/linux/utrace.h  2009-03-03 20:43:43.000000000 +0100
@@ -100,7 +100,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));
--- xxx/include/linux/tracehook.h~KILL_COOKIE   2009-03-03 18:11:47.000000000 
+0100
+++ xxx/include/linux/tracehook.h       2009-03-03 20:40:57.000000000 +0100
@@ -534,7 +534,6 @@ static inline int tracehook_notify_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
@@ -546,10 +545,8 @@ static inline int tracehook_notify_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->exit_signal == -1)
                return task->ptrace ? SIGCHLD : DEATH_REAP;
 
@@ -568,14 +565,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.
@@ -583,13 +578,12 @@ 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)
 {
        smp_mb();
        if (task_utrace_flags(task) & (UTRACE_EVENT(DEATH) |
                                       UTRACE_EVENT(QUIESCE)))
-               utrace_report_death(task, death_cookie, group_dead, signal);
+               utrace_report_death(task, group_dead, signal);
 }
 
 #ifdef TIF_NOTIFY_RESUME
--- xxx/kernel/exit.c~KILL_COOKIE       2009-03-03 18:11:47.000000000 +0100
+++ xxx/kernel/exit.c   2009-03-03 20:42:20.000000000 +0100
@@ -917,7 +917,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:
@@ -954,7 +953,7 @@ static void exit_notify(struct task_stru
            !capable(CAP_KILL))
                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);
 
@@ -968,7 +967,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)
--- xxx/kernel/utrace.c~KILL_COOKIE     2009-03-03 18:11:47.000000000 +0100
+++ xxx/kernel/utrace.c 2009-03-03 20:46:09.000000000 +0100
@@ -1675,9 +1675,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);

Reply via email to