td->td_critnest manipulations do not use atomic_add_int ?
ssouhlal at FreeBSD.org
Tue Dec 20 06:35:00 PST 2005
Luigi Rizzo wrote:
> as in the subject... i see that td->td_critnest (used to determine
> whether a thread can be preempted or not) is manipulated using
> plain ++ or -- instruction instead of the atomic_add_int().
This should be fine as it only gets modified by the current thread. If
an interrupt comes while we are decreasing td_critnest back to 0, then
we just don't get preempted immediately, but at the end of our quantum,
or when someone else tries to preempt us, whichever comes first, which
should be totally harmless.
More information about the freebsd-current