- File:
-
- 1 edited
-
libcfa/src/concurrency/ready_queue.cfa (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
r8cd5434 rd3ba775 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;406 400 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; 407 409 } 408 410 else { … … 416 418 417 419 for(READYQ_SHARD_FACTOR) { 418 unsigned i = proc->rdq.id + ( proc->rdq.itr++% READYQ_SHARD_FACTOR);420 unsigned i = proc->rdq.id + (--proc->rdq.itr % READYQ_SHARD_FACTOR); 419 421 if($thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.local))) return t; 420 422 } … … 467 469 // Actually pop the list 468 470 struct $thread * thrd; 469 unsigned long long tsv; 470 [thrd, tsv] = pop(lane); 471 thrd = pop(lane); 471 472 472 473 /* paranoid */ verify(thrd); … … 480 481 481 482 #if defined(USE_WORK_STEALING) 482 lanes.tscs[w].tv = t sv;483 lanes.tscs[w].tv = thrd->link.ts; 483 484 #endif 484 485 … … 662 663 while(!is_empty(lanes.data[idx])) { 663 664 struct $thread * thrd; 664 unsigned long long _; 665 [thrd, _] = pop(lanes.data[idx]); 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.