Descriptionruntime: simplify lock-free logic in netpoll
Before, pd.closing, pd.rt/pd.wt, and pd.rg/pd.wg were all
accessed in a lock-free manner. In this CL, the bits being
checked in pd.closing and pd.rt/pd.wt are moved into the
low bits of pd.rg/pd.wg, so that there is only one memory
word being accessed lock-free.
Austin, Rick, and I spent two hours at a wall-sized whiteboard
covered with the relevant flow of the existing code this morning.
We were unable to find a flaw but also unable to convince ourselves
it is correct. Having just one lock-free word (one for reader and
one for writer, but those are independent) should be much easier
to reason about, and it may actually be correct.
This change is for Go 1.5, not Go 1.4.
(If adding the Go 1.2 locks back to the current implementation
fixes the problems we are seeing, we will ship Go 1.4 with locks.)
Patch Set 1 #Patch Set 2 : diff -r 752cd91996392503c6577ad1c1cc9f53f3fd3d89 https://code.google.com/p/go/ #Patch Set 3 : diff -r 752cd91996392503c6577ad1c1cc9f53f3fd3d89 https://code.google.com/p/go/ #
Total comments: 20
MessagesTotal messages: 10
|