Abolishing sleeps in issignal()
Matthew Dillon
dillon at apollo.backplane.com
Tue Oct 9 16:43:21 PDT 2007
I noticed the sigstop cascade with NFS a year or two ago and changed
the way DragonFly handles SIGSTOP to no longer actually stop the
process in the sleep code. What it does instead is set the process
(or thread) state to SSTOP, but does not actually stop the process
until the process tries to return to userland.
All the stop handling was moved to userret(). It works just dandy,
The only issue that cropped up from doing things this way is that
when you ^Z a program that is blocked on I/O, the program will complete
the I/O before actually going to sleep. This seems to only have a
visible effect for programs outputting a lot of junk to stdout. One
additional line will be written to stdout after the ^Z is delivered
before the process actually stops.
'ps' output will also show the process not go into an immediate stop
state but since the condition has to be flagged it is really easy to
adjust ps to report that the process is stopped even though it isn't
quite stopped yet.
This change saved us a lot of headaches and simplified a number of
code paths. Frankly, userret is the ONLY safe place where you can
actually stop a process these days.
-Matt
More information about the freebsd-arch
mailing list