Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=fea9d175545b38cb3e84569400419eb81bc90fa3
Commit:     fea9d175545b38cb3e84569400419eb81bc90fa3
Parent:     46f382d2b69d2221086b823f0dbc8f32c027cac2
Author:     Oleg Nesterov <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 8 04:19:19 2008 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Fri Feb 8 09:22:29 2008 -0800

    ITIMER_REAL: convert to use struct pid
    
    signal_struct->tsk points to the ->group_leader and thus we have the nasty
    code in de_thread() which has to change it and restart ->real_timer if the
    leader is changed.
    
    Use "struct pid *leader_pid" instead.  This also allows us to kill now
    unneeded send_group_sig_info().
    
    Signed-off-by: Oleg Nesterov <[EMAIL PROTECTED]>
    Acked-by: "Eric W. Biederman" <[EMAIL PROTECTED]>
    Cc: Davide Libenzi <[EMAIL PROTECTED]>
    Cc: Pavel Emelyanov <[EMAIL PROTECTED]>
    Acked-by: Roland McGrath <[EMAIL PROTECTED]>
    Acked-by: Thomas Gleixner <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
---
 fs/exec.c             |   22 ++--------------------
 include/linux/sched.h |    3 +--
 kernel/fork.c         |    2 +-
 kernel/itimer.c       |    2 +-
 kernel/signal.c       |   14 --------------
 5 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index be923e4..927a7c5 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -782,26 +782,8 @@ static int de_thread(struct task_struct *tsk)
        zap_other_threads(tsk);
        read_unlock(&tasklist_lock);
 
-       /*
-        * Account for the thread group leader hanging around:
-        */
-       count = 1;
-       if (!thread_group_leader(tsk)) {
-               count = 2;
-               /*
-                * The SIGALRM timer survives the exec, but needs to point
-                * at us as the new group leader now.  We have a race with
-                * a timer firing now getting the old leader, so we need to
-                * synchronize with any firing (by calling del_timer_sync)
-                * before we can safely let the old group leader die.
-                */
-               sig->tsk = tsk;
-               spin_unlock_irq(lock);
-               if (hrtimer_cancel(&sig->real_timer))
-                       hrtimer_restart(&sig->real_timer);
-               spin_lock_irq(lock);
-       }
-
+       /* Account for the thread group leader hanging around: */
+       count = thread_group_leader(tsk) ? 1 : 2;
        sig->notify_count = count;
        while (atomic_read(&sig->count) > count) {
                __set_current_state(TASK_UNINTERRUPTIBLE);
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 3deb6e5..b2d161d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -460,7 +460,7 @@ struct signal_struct {
 
        /* ITIMER_REAL timer for the process */
        struct hrtimer real_timer;
-       struct task_struct *tsk;
+       struct pid *leader_pid;
        ktime_t it_real_incr;
 
        /* ITIMER_PROF and ITIMER_VIRTUAL timers for the process */
@@ -1686,7 +1686,6 @@ extern void block_all_signals(int (*notifier)(void 
*priv), void *priv,
 extern void unblock_all_signals(void);
 extern void release_task(struct task_struct * p);
 extern int send_sig_info(int, struct siginfo *, struct task_struct *);
-extern int send_group_sig_info(int, struct siginfo *, struct task_struct *);
 extern int force_sigsegv(int, struct task_struct *);
 extern int force_sig_info(int, struct siginfo *, struct task_struct *);
 extern int __kill_pgrp_info(int sig, struct siginfo *info, struct pid *pgrp);
diff --git a/kernel/fork.c b/kernel/fork.c
index b2ef8e4..ca54d97 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -909,7 +909,6 @@ static int copy_signal(unsigned long clone_flags, struct 
task_struct *tsk)
        hrtimer_init(&sig->real_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
        sig->it_real_incr.tv64 = 0;
        sig->real_timer.function = it_real_fn;
-       sig->tsk = tsk;
 
        sig->it_virt_expires = cputime_zero;
        sig->it_virt_incr = cputime_zero;
@@ -1338,6 +1337,7 @@ static struct task_struct *copy_process(unsigned long 
clone_flags,
                        if (clone_flags & CLONE_NEWPID)
                                p->nsproxy->pid_ns->child_reaper = p;
 
+                       p->signal->leader_pid = pid;
                        p->signal->tty = current->signal->tty;
                        set_task_pgrp(p, task_pgrp_nr(current));
                        set_task_session(p, task_session_nr(current));
diff --git a/kernel/itimer.c b/kernel/itimer.c
index 2fab344..ab98274 100644
--- a/kernel/itimer.c
+++ b/kernel/itimer.c
@@ -132,7 +132,7 @@ enum hrtimer_restart it_real_fn(struct hrtimer *timer)
        struct signal_struct *sig =
                container_of(timer, struct signal_struct, real_timer);
 
-       send_group_sig_info(SIGALRM, SEND_SIG_PRIV, sig->tsk);
+       kill_pid_info(SIGALRM, SEND_SIG_PRIV, sig->leader_pid);
 
        return HRTIMER_NORESTART;
 }
diff --git a/kernel/signal.c b/kernel/signal.c
index b0b43a4..cc45a6b 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1205,20 +1205,6 @@ send_sig(int sig, struct task_struct *p, int priv)
        return send_sig_info(sig, __si_special(priv), p);
 }
 
-/*
- * This is the entry point for "process-wide" signals.
- * They will go to an appropriate thread in the thread group.
- */
-int
-send_group_sig_info(int sig, struct siginfo *info, struct task_struct *p)
-{
-       int ret;
-       read_lock(&tasklist_lock);
-       ret = group_send_sig_info(sig, info, p);
-       read_unlock(&tasklist_lock);
-       return ret;
-}
-
 void
 force_sig(int sig, struct task_struct *p)
 {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to