Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

semaphore: __down_common: use signal_pending_state()

Change __down_common() to use signal_pending_state() instead of open
coding.

The changes in kernel/semaphore.o are just artifacts, the state checks are
optimized away.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Oleg Nesterov and committed by
Linus Torvalds
5b2becc8 32194450

+1 -3
+1 -3
kernel/semaphore.c
··· 212 212 waiter.up = 0; 213 213 214 214 for (;;) { 215 - if (state == TASK_INTERRUPTIBLE && signal_pending(task)) 216 - goto interrupted; 217 - if (state == TASK_KILLABLE && fatal_signal_pending(task)) 215 + if (signal_pending_state(state, task)) 218 216 goto interrupted; 219 217 if (timeout <= 0) 220 218 goto timed_out;