Skip to content

Commit

Permalink
signals: inline __fatal_signal_pending
Browse files Browse the repository at this point in the history
__fatal_signal_pending inlines to one instruction on x86, probably two
instructions on other machines.  It takes two longer x86 instructions just
to call it and test its return value, not to mention the function itself.

On my random x86_64 config, this saved 70 bytes of text (59 of those being
__fatal_signal_pending itself).

Signed-off-by: Roland McGrath <roland@redhat.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Roland McGrath authored and Linus Torvalds committed Sep 24, 2009
1 parent ba0a6c9 commit d958872
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 4 additions & 1 deletion include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -2337,7 +2337,10 @@ static inline int signal_pending(struct task_struct *p)
return unlikely(test_tsk_thread_flag(p,TIF_SIGPENDING));
}

extern int __fatal_signal_pending(struct task_struct *p);
static inline int __fatal_signal_pending(struct task_struct *p)
{
return unlikely(sigismember(&p->pending.signal, SIGKILL));
}

static inline int fatal_signal_pending(struct task_struct *p)
{
Expand Down
6 changes: 0 additions & 6 deletions kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1050,12 +1050,6 @@ void zap_other_threads(struct task_struct *p)
}
}

int __fatal_signal_pending(struct task_struct *tsk)
{
return sigismember(&tsk->pending.signal, SIGKILL);
}
EXPORT_SYMBOL(__fatal_signal_pending);

struct sighand_struct *lock_task_sighand(struct task_struct *tsk, unsigned long *flags)
{
struct sighand_struct *sighand;
Expand Down

0 comments on commit d958872

Please sign in to comment.