Skip to content

Commit 59dc6f3

Browse files
anna-marialxKAGA-KOKO
authored andcommitted
signal: Remove no longer required irqsave/restore
Commit a841796 ("signal: align __lock_task_sighand() irq disabling and RCU") introduced a rcu read side critical section with interrupts disabled. The changelog suggested that a better long-term fix would be "to make rt_mutex_unlock() disable irqs when acquiring the rt_mutex structure's ->wait_lock". This long-term fix has been made in commit b4abf91 ("rtmutex: Make wait_lock irq safe") for a different reason. Therefore revert commit a841796 ("signal: align > __lock_task_sighand() irq disabling and RCU") as the interrupt disable dance is not longer required. The change was tested on the base of b4abf91 ("rtmutex: Make wait_lock irq safe") with a four hour run of rcutorture scenario TREE03 with lockdep enabled as suggested by Paul McKenney. Signed-off-by: Anna-Maria Gleixner <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Acked-by: "Eric W. Biederman" <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
1 parent ec84b27 commit 59dc6f3

File tree

1 file changed

+7
-17
lines changed

1 file changed

+7
-17
lines changed

kernel/signal.c

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,19 +1244,12 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
12441244
{
12451245
struct sighand_struct *sighand;
12461246

1247+
rcu_read_lock();
12471248
for (;;) {
1248-
/*
1249-
* Disable interrupts early to avoid deadlocks.
1250-
* See rcu_read_unlock() comment header for details.
1251-
*/
1252-
local_irq_save(*flags);
1253-
rcu_read_lock();
12541249
sighand = rcu_dereference(tsk->sighand);
1255-
if (unlikely(sighand == NULL)) {
1256-
rcu_read_unlock();
1257-
local_irq_restore(*flags);
1250+
if (unlikely(sighand == NULL))
12581251
break;
1259-
}
1252+
12601253
/*
12611254
* This sighand can be already freed and even reused, but
12621255
* we rely on SLAB_TYPESAFE_BY_RCU and sighand_ctor() which
@@ -1268,15 +1261,12 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
12681261
* __exit_signal(). In the latter case the next iteration
12691262
* must see ->sighand == NULL.
12701263
*/
1271-
spin_lock(&sighand->siglock);
1272-
if (likely(sighand == tsk->sighand)) {
1273-
rcu_read_unlock();
1264+
spin_lock_irqsave(&sighand->siglock, *flags);
1265+
if (likely(sighand == tsk->sighand))
12741266
break;
1275-
}
1276-
spin_unlock(&sighand->siglock);
1277-
rcu_read_unlock();
1278-
local_irq_restore(*flags);
1267+
spin_unlock_irqrestore(&sighand->siglock, *flags);
12791268
}
1269+
rcu_read_unlock();
12801270

12811271
return sighand;
12821272
}

0 commit comments

Comments
 (0)