Commit f8c5b5c0 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Linus Torvalds

signals: __group_complete_signal: cache the value of p->signal

Cosmetic, cache p->signal to make the code a bit more readable.
Signed-off-by: default avatarOleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5fc894bb
...@@ -842,6 +842,7 @@ static inline int wants_signal(int sig, struct task_struct *p) ...@@ -842,6 +842,7 @@ static inline int wants_signal(int sig, struct task_struct *p)
static void static void
__group_complete_signal(int sig, struct task_struct *p) __group_complete_signal(int sig, struct task_struct *p)
{ {
struct signal_struct *signal = p->signal;
struct task_struct *t; struct task_struct *t;
/* /*
...@@ -862,14 +863,14 @@ __group_complete_signal(int sig, struct task_struct *p) ...@@ -862,14 +863,14 @@ __group_complete_signal(int sig, struct task_struct *p)
/* /*
* Otherwise try to find a suitable thread. * Otherwise try to find a suitable thread.
*/ */
t = p->signal->curr_target; t = signal->curr_target;
if (t == NULL) if (t == NULL)
/* restart balancing at this thread */ /* restart balancing at this thread */
t = p->signal->curr_target = p; t = signal->curr_target = p;
while (!wants_signal(sig, t)) { while (!wants_signal(sig, t)) {
t = next_thread(t); t = next_thread(t);
if (t == p->signal->curr_target) if (t == signal->curr_target)
/* /*
* No thread needs to be woken. * No thread needs to be woken.
* Any eligible threads will see * Any eligible threads will see
...@@ -877,14 +878,14 @@ __group_complete_signal(int sig, struct task_struct *p) ...@@ -877,14 +878,14 @@ __group_complete_signal(int sig, struct task_struct *p)
*/ */
return; return;
} }
p->signal->curr_target = t; signal->curr_target = t;
} }
/* /*
* Found a killable thread. If the signal will be fatal, * Found a killable thread. If the signal will be fatal,
* then start taking the whole group down immediately. * then start taking the whole group down immediately.
*/ */
if (sig_fatal(p, sig) && !(p->signal->flags & SIGNAL_GROUP_EXIT) && if (sig_fatal(p, sig) && !(signal->flags & SIGNAL_GROUP_EXIT) &&
!sigismember(&t->real_blocked, sig) && !sigismember(&t->real_blocked, sig) &&
(sig == SIGKILL || !(t->ptrace & PT_PTRACED))) { (sig == SIGKILL || !(t->ptrace & PT_PTRACED))) {
/* /*
...@@ -897,9 +898,9 @@ __group_complete_signal(int sig, struct task_struct *p) ...@@ -897,9 +898,9 @@ __group_complete_signal(int sig, struct task_struct *p)
* running and doing things after a slower * running and doing things after a slower
* thread has the fatal signal pending. * thread has the fatal signal pending.
*/ */
p->signal->flags = SIGNAL_GROUP_EXIT; signal->flags = SIGNAL_GROUP_EXIT;
p->signal->group_exit_code = sig; signal->group_exit_code = sig;
p->signal->group_stop_count = 0; signal->group_stop_count = 0;
t = p; t = p;
do { do {
sigaddset(&t->pending.signal, SIGKILL); sigaddset(&t->pending.signal, SIGKILL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment