- File:
-
- 1 edited
-
libcfa/src/concurrency/ready_queue.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
rd3ba775 r8cd5434 398 398 399 399 if(proc->rdq.target == -1u) { 400 unsigned long long min = ts(lanes.data[proc->rdq.id]); 401 for(int i = 0; i < READYQ_SHARD_FACTOR; i++) { 402 unsigned long long tsc = ts(lanes.data[proc->rdq.id + i]); 403 if(tsc < min) min = tsc; 404 } 405 proc->rdq.cutoff = min; 400 406 proc->rdq.target = __tls_rand() % lanes.count; 401 unsigned it1 = proc->rdq.itr;402 unsigned it2 = proc->rdq.itr + 1;403 unsigned idx1 = proc->rdq.id + (it1 % READYQ_SHARD_FACTOR);404 unsigned idx2 = proc->rdq.id + (it2 % READYQ_SHARD_FACTOR);405 unsigned long long tsc1 = ts(lanes.data[idx1]);406 unsigned long long tsc2 = ts(lanes.data[idx2]);407 proc->rdq.cutoff = min(tsc1, tsc2);408 if(proc->rdq.cutoff == 0) proc->rdq.cutoff = -1ull;409 407 } 410 408 else { … … 418 416 419 417 for(READYQ_SHARD_FACTOR) { 420 unsigned i = proc->rdq.id + ( --proc->rdq.itr% READYQ_SHARD_FACTOR);418 unsigned i = proc->rdq.id + (proc->rdq.itr++ % READYQ_SHARD_FACTOR); 421 419 if($thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t; 422 420 } … … 469 467 // Actually pop the list 470 468 struct $thread * thrd; 471 thrd = pop(lane); 469 unsigned long long tsv; 470 [thrd, tsv] = pop(lane); 472 471 473 472 /* paranoid */ verify(thrd); … … 481 480 482 481 #if defined(USE_WORK_STEALING) 483 lanes.tscs[w].tv = t hrd->link.ts;482 lanes.tscs[w].tv = tsv; 484 483 #endif 485 484 … … 663 662 while(!is_empty(lanes.data[idx])) { 664 663 struct $thread * thrd; 665 thrd = pop(lanes.data[idx]); 664 unsigned long long _; 665 [thrd, _] = pop(lanes.data[idx]); 666 666 667 667 push(cltr, thrd); … … 702 702 /* paranoid */ verify( ready_mutate_islocked() ); 703 703 } 704 705 #if !defined(__CFA_NO_STATISTICS__) 706 unsigned cnt(const __ready_queue_t & this, unsigned idx) { 707 /* paranoid */ verify(this.lanes.count > idx); 708 return this.lanes.data[idx].cnt; 709 } 710 #endif
Note:
See TracChangeset
for help on using the changeset viewer.