The patch titled consolidate-checking-for-ignored-legacy-signals-simplify has been added to the -mm tree. Its filename is consolidate-checking-for-ignored-legacy-signals-simplify.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: consolidate-checking-for-ignored-legacy-signals-simplify From: Oleg Nesterov <oleg@xxxxxxxxxx> Every user of send_signal() must check ret twice. Change the meaning of the returned value, so that ret <= 0 means we can just return, and ret == 1 means the signal was queued. Saves a couple of if's and imho makes the code more logical. Also, remove now unneeded "ret = 0" initializions. Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Acked-by: Pavel Emelyanov <xemul@xxxxxxxxxx> Cc: Roland McGrath <roland@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- kernel/signal.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff -puN kernel/signal.c~consolidate-checking-for-ignored-legacy-signals-simplify kernel/signal.c --- a/kernel/signal.c~consolidate-checking-for-ignored-legacy-signals-simplify +++ a/kernel/signal.c @@ -673,7 +673,7 @@ static int send_signal(int sig, struct s * detailed information about the cause of the signal. */ if (sig_ignored(t, sig) || legacy_queue(signals, sig)) - return 1; + return 0; /* * Deliver the signal to listening signalfds. This must be called @@ -731,7 +731,7 @@ static int send_signal(int sig, struct s out_set: sigaddset(&signals->signal, sig); - return 0; + return 1; } int print_fatal_signals; @@ -769,16 +769,16 @@ __setup("print-fatal-signals=", setup_pr static int specific_send_sig_info(int sig, struct siginfo *info, struct task_struct *t) { - int ret = 0; + int ret; BUG_ON(!irqs_disabled()); assert_spin_locked(&t->sighand->siglock); ret = send_signal(sig, info, t, &t->pending); - if (ret < 0) + if (ret <= 0) return ret; - if (!ret && !sigismember(&t->blocked, sig)) + if (!sigismember(&t->blocked, sig)) signal_wake_up(t, sig == SIGKILL); return 0; } @@ -925,7 +925,7 @@ __group_complete_signal(int sig, struct int __group_send_sig_info(int sig, struct siginfo *info, struct task_struct *p) { - int ret = 0; + int ret; assert_spin_locked(&p->sighand->siglock); handle_stop_signal(sig, p); @@ -936,11 +936,10 @@ __group_send_sig_info(int sig, struct si * to avoid several races. */ ret = send_signal(sig, info, p, &p->signal->shared_pending); - if (unlikely(ret < 0)) + if (ret <= 0) return ret; - if (!ret) - __group_complete_signal(sig, p); + __group_complete_signal(sig, p); return 0; } _ Patches currently in -mm which might be from oleg@xxxxxxxxxx are origin.patch revert-proc-fix-the-threaded-proc-self.patch remove-unused-variable-from-send_signal.patch turn-legacy_queue-macro-into-static-inline-function.patch consolidate-checking-for-ignored-legacy-signals.patch consolidate-checking-for-ignored-legacy-signals-simplify.patch procfs-task-exe-symlink.patch procfs-task-exe-symlink-fix.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html