]> git.baikalelectronics.ru Git - kernel.git/commitdiff
signal: Don't send siginfo to kthreads.
authorEric W. Biederman <ebiederm@xmission.com>
Fri, 20 Jul 2018 10:31:53 +0000 (05:31 -0500)
committerEric W. Biederman <ebiederm@xmission.com>
Tue, 11 Sep 2018 19:19:22 +0000 (21:19 +0200)
Today kernel threads never dequeue siginfo so it is pointless to
enqueue siginfo for them.  The usb gadget mass storage driver goes
one farther and uses SEND_SIG_FORCED to guarantee that no siginfo is
even enqueued.

Generalize the optimization of the usb mass storage driver and never
perform an unnecessary allocation when delivering signals to kthreads.

Switch the mass storage driver from sending signals with
SEND_SIG_FORCED to SEND_SIG_PRIV.  As using SEND_SIG_FORCED is now
unnecessary.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
drivers/usb/gadget/function/f_mass_storage.c
kernel/signal.c

index 70038a475c9fea37f2ed46fad8db28d978175216..cb402e7a1e9b8d7e39f5eba26f8881599f04a7b9 100644 (file)
@@ -403,7 +403,7 @@ static void raise_exception(struct fsg_common *common, enum fsg_state new_state)
                common->exception_req_tag = common->ep0_req_tag;
                common->state = new_state;
                if (common->thread_task)
-                       send_sig_info(SIGUSR1, SEND_SIG_FORCED,
+                       send_sig_info(SIGUSR1, SEND_SIG_PRIV,
                                      common->thread_task);
        }
        spin_unlock_irqrestore(&common->lock, flags);
index 8081ab79e97d5457560a2fd56cea340ba6845591..20931a892ace10e1c0a8d17620283b47d4a41eac 100644 (file)
@@ -1057,7 +1057,7 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
         * fast-pathed signals for kernel-internal things like SIGSTOP
         * or SIGKILL.
         */
-       if (info == SEND_SIG_FORCED)
+       if ((info == SEND_SIG_FORCED) || (t->flags & PF_KTHREAD))
                goto out_set;
 
        /*