Commit 848376c7 authored by Roland McGrath's avatar Roland McGrath Committed by Tony Luck

[IA64] TS_RESTORE_SIGMASK

Replace TIF_RESTORE_SIGMASK with TS_RESTORE_SIGMASK and define
our own set_restore_sigmask() function.  This saves the costly
SMP-safe set_bit operation, which we do not need for the sigmask
flag since TIF_SIGPENDING always has to be set too.
Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent c0cd661b
...@@ -463,7 +463,7 @@ sys32_sigsuspend (int history0, int history1, old_sigset_t mask) ...@@ -463,7 +463,7 @@ sys32_sigsuspend (int history0, int history1, old_sigset_t mask)
current->state = TASK_INTERRUPTIBLE; current->state = TASK_INTERRUPTIBLE;
schedule(); schedule();
set_thread_flag(TIF_RESTORE_SIGMASK); set_restore_sigmask();
return -ERESTARTNOHAND; return -ERESTARTNOHAND;
} }
......
...@@ -464,7 +464,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) ...@@ -464,7 +464,7 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
if (!user_mode(&scr->pt)) if (!user_mode(&scr->pt))
return; return;
if (test_thread_flag(TIF_RESTORE_SIGMASK)) if (current_thread_info()->status & TS_RESTORE_SIGMASK)
oldset = &current->saved_sigmask; oldset = &current->saved_sigmask;
else else
oldset = &current->blocked; oldset = &current->blocked;
...@@ -530,12 +530,13 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) ...@@ -530,12 +530,13 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
* continue to iterate in this loop so we can deliver the SIGSEGV... * continue to iterate in this loop so we can deliver the SIGSEGV...
*/ */
if (handle_signal(signr, &ka, &info, oldset, scr)) { if (handle_signal(signr, &ka, &info, oldset, scr)) {
/* a signal was successfully delivered; the saved /*
* A signal was successfully delivered; the saved
* sigmask will have been stored in the signal frame, * sigmask will have been stored in the signal frame,
* and will be restored by sigreturn, so we can simply * and will be restored by sigreturn, so we can simply
* clear the TIF_RESTORE_SIGMASK flag */ * clear the TS_RESTORE_SIGMASK flag.
if (test_thread_flag(TIF_RESTORE_SIGMASK)) */
clear_thread_flag(TIF_RESTORE_SIGMASK); current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
return; return;
} }
} }
...@@ -566,8 +567,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall) ...@@ -566,8 +567,8 @@ ia64_do_signal (struct sigscratch *scr, long in_syscall)
/* if there's no signal to deliver, we just put the saved sigmask /* if there's no signal to deliver, we just put the saved sigmask
* back */ * back */
if (test_thread_flag(TIF_RESTORE_SIGMASK)) { if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
clear_thread_flag(TIF_RESTORE_SIGMASK); current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
} }
} }
...@@ -108,13 +108,11 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); ...@@ -108,13 +108,11 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
#define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */ #define TIF_DB_DISABLED 19 /* debug trap disabled for fsyscall */
#define TIF_FREEZE 20 /* is freezing for suspend */ #define TIF_FREEZE 20 /* is freezing for suspend */
#define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */ #define TIF_RESTORE_RSE 21 /* user RBS is newer than kernel RBS */
#define TIF_RESTORE_SIGMASK 22 /* restore signal mask in do_signal() */
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) #define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
#define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP) #define _TIF_SINGLESTEP (1 << TIF_SINGLESTEP)
#define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP) #define _TIF_SYSCALL_TRACEAUDIT (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
...@@ -131,7 +129,18 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk); ...@@ -131,7 +129,18 @@ extern void tsk_clear_notify_resume(struct task_struct *tsk);
#define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT)) #define TIF_WORK_MASK (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
#define TS_POLLING 1 /* true if in idle loop and not sleeping */ #define TS_POLLING 1 /* true if in idle loop and not sleeping */
#define TS_RESTORE_SIGMASK 2 /* restore signal mask in do_signal() */
#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) #define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING)
#ifndef __ASSEMBLY__
#define HAVE_SET_RESTORE_SIGMASK 1
static inline void set_restore_sigmask(void)
{
struct thread_info *ti = current_thread_info();
ti->status |= TS_RESTORE_SIGMASK;
set_bit(TIF_SIGPENDING, &ti->flags);
}
#endif /* !__ASSEMBLY__ */
#endif /* _ASM_IA64_THREAD_INFO_H */ #endif /* _ASM_IA64_THREAD_INFO_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment