Why use volatile for socket state?
Mulyadi Santosa
mulyadi.santosa at gmail.com
Tue May 15 03:25:14 CDT 2007
Hi
> Why do we need the socket state (for the nework layer
> representation of the sockets) to be
> volatile?
> It is implemented as volatile unsigned char skc_state in
> struct sock_common .
I personally think this is done to prevent looking up the state on the
CPU registers. In other word, query is always directed toward physical
memory. Yes, it lowers the perfomance but maybe it is designed that
way so we won't get wrong socket state.
regards,
Mulyadi
More information about the Kernel-mentors
mailing list