Rename 't' to 'tso'.
147 EXTERN_INLINE void
148 annulTSO(StgTSO *tso) {
149 // hack to make some invariants with regards to block_info and _link work
150 // this is called whereever we would have stepped all over the
151 // fields in the linked list implementation
152 tso->_link = END_TSO_QUEUE;
153 tso->block_info.closure = (StgClosure*)END_TSO_QUEUE;
It would be great to have a pointer to the invariants, or the invariant(s) documented.
213 tso->ss_pass += tso->ss_stride;
214 StgWord64 r;
215 if (tso->ss_pass <= cap->ss_pass) {
216 // Thread is behind, it will get scheduled in front with no
217 // intervention (note that cap->ss_pass is probably nonsense,
218 // since it doesn't include *this* thread.)
219 r = tso->ss_pass;
220 } else if (tso->ss_pass - tso->ss_pass <= cap->ss_pass) {
This expression looks weird/magic, tso->ss_pass - tso->ss_pass is 0.
221 // Thread is in good standing, schedule it in front
222 // (next iteration, they will not be in good standing if
223 // the global pass doesn't advance by much; that is, this
224 // thread managed to cut in front of other threads which
225 // are running behind.)
226 r = cap->ss_pass;
227 } else {
228 // Thread is not in good standing, schedule it later.
229 // Eventually, global pass will advance enough that the
230 // thread will be in good standing again, and can cut
231 // to the front.
232 r = tso->ss_pass;
361 if (migrating) {
362 joinRunQueue(cap,tso);
363 } else {
364 appendToRunQueue(cap,tso);
365 }
Space after ','
Select.c: and rts/win32/AsyncIO.c
309 tso->ss_remain = 0;
310 joinRunQueue(&MainCapability,tso);
Should this be an abstraction in itself?
rts/Capability.h:
59 PQueue *run_pqueue;
60
61 // [SSS] Stride scheduling extensions. The Task with this
62 // Capability has exclusive access to this variable.
63 nat ss_pass;
Document ss_pass. For example how it relates to capPassUpdate and pushOnRunQueue (the weird/magic I commented on above) and invariants.
Alexander