Commit 0840a90d943bcde2fbfeabd3c256236eed2273cd

Authored by Oleg Nesterov
Committed by Linus Torvalds
1 parent 2b47c3611d

exec: simplify ->sighand switching

There is no any reason to do recalc_sigpending() after changing ->sighand.
To begin with, recalc_sigpending() does not take ->sighand into account.

This means we don't need to take newsighand->siglock while changing sighands.
rcu_assign_pointer() provides a necessary barrier, and if another process
reads the new ->sighand it should either take tasklist_lock or it should use
lock_task_sighand() which has a corresponding smp_read_barrier_depends().

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 1 additions and 7 deletions Side-by-side Diff

... ... @@ -916,12 +916,7 @@
916 916  
917 917 write_lock_irq(&tasklist_lock);
918 918 spin_lock(&oldsighand->siglock);
919   - spin_lock_nested(&newsighand->siglock, SINGLE_DEPTH_NESTING);
920   -
921 919 rcu_assign_pointer(tsk->sighand, newsighand);
922   - recalc_sigpending();
923   -
924   - spin_unlock(&newsighand->siglock);
925 920 spin_unlock(&oldsighand->siglock);
926 921 write_unlock_irq(&tasklist_lock);
927 922  
928 923  
... ... @@ -931,12 +926,11 @@
931 926 BUG_ON(!thread_group_leader(tsk));
932 927 return 0;
933 928 }
934   -
  929 +
935 930 /*
936 931 * These functions flushes out all traces of the currently running executable
937 932 * so that a new one can be started
938 933 */
939   -
940 934 static void flush_old_files(struct files_struct * files)
941 935 {
942 936 long j = -1;