[OpenAFS-devel] Very simple patch for libafs CPU hog on signal

Derek Atkins warlord@MIT.EDU
29 Jan 2002 11:05:51 -0500


Nickolai Zeldovich <kolya@MIT.EDU> writes:

> > Actually, your patch _can_ lose signals if they happen _inside_
> > the sleep().  For example:
> > 
> >  save_signals           <-- save an "empty" sigset
> >  sleep                  <-- signal comes in here
> >  restore_signals        <-- restore the empty sigset, thereby losing
> >                             the signal that came in above.
> 
> But in my patch, the sigset I'm saving is the blocked sigset, not the
> pending sigset.  When the signal is delivered during sleep, the kernel
> doesn't wake us up, because the signal is masked out in the blocked
> sigset.  When we come out of sleep, we restore the blocked set to what
> it was before (probably empty) and recompute the sigpending flag, so
> the signal will be delivered on syscall completion.

Ahh, must've missed that (or misread it).  Cool. :)

For some reason I thought you were saving and restoring the actual
sigset, not the sig mask.  I don't know why.

> -- kolya

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available