]> git.karo-electronics.de Git - linux-beck.git/commitdiff
signal: Explain local_irq_save() call
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Mon, 5 May 2014 15:18:30 +0000 (08:18 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Wed, 9 Jul 2014 16:14:33 +0000 (09:14 -0700)
The explicit local_irq_save() in __lock_task_sighand() is needed to avoid
a potential deadlock condition, as noted in a841796f11c90d53 (signal:
align __lock_task_sighand() irq disabling and RCU).  However, someone
reading the code might be forgiven for concluding that this separate
local_irq_save() was completely unnecessary.  This commit therefore adds
a comment referencing the shiny new block comment on rcu_read_unlock().

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
kernel/signal.c

index a4077e90f19fcba4776af7f62a9ed2d4ddb9de03..40b76e351e64aae9cb92039d3d77332afac50d51 100644 (file)
@@ -1263,6 +1263,10 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
        struct sighand_struct *sighand;
 
        for (;;) {
+               /*
+                * Disable interrupts early to avoid deadlocks.
+                * See rcu_read_unlock() comment header for details.
+                */
                local_irq_save(*flags);
                rcu_read_lock();
                sighand = rcu_dereference(tsk->sighand);