这个问题我也在stack overflow上问了
http://stackoverflow.com/questions/29838398/how-could-sys-sigsuspend-is-atomical-in-linux-kernel-2-6-11
"the sigsuspend() system call does not allow signals to be sent after unblocking and before the schedule() invocation, because other processes cannot grab the CPU during that time interval"
但是从代码上看spin_unlock_irq之后到schedule()之前完全可以被其他CPU抢占。这个原子操作怎么实现呢?
sys_sigsuspend(int history0, int history1, old_sigset_t mask)
{
struct pt_regs * regs = (struct pt_regs *) &history0;
sigset_t saveset;
mask &= _BLOCKABLE;
spin_lock_irq(¤t->sighand->siglock);
saveset = current->blocked;
siginitset(¤t->blocked, mask);
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
regs->eax = -EINTR;
while (1) {
current->state = TASK_INTERRUPTIBLE;
schedule();
if (do_signal(regs, &saveset))
return -EINTR;
}
}