Changeset 25337e0
- Timestamp:
- Jan 17, 2022, 7:46:29 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 0fb3ee5
- Parents:
- 0fc447c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/ready_queue.cfa
r0fc447c r25337e0 303 303 lanes.help[idx].dst = 0; 304 304 lanes.help[idx].tri = 0; 305 }306 307 caches = alloc( cpu_info.llc_count );308 for( idx; (size_t)cpu_info.llc_count ) {309 (caches[idx]){};310 305 } 311 306 #else … … 506 501 } 507 502 508 static inline int pop_getcpu(processor * proc, __ready_queue_caches_t * caches) {509 const int prv = proc->rdq.cpu;510 const int cpu = __kernel_getcpu();511 if( prv != proc->rdq.cpu ) {512 unsigned pidx = cpu_info.llc_map[prv].cache;513 /* paranoid */ verify(pidx < cpu_info.llc_count);514 515 unsigned nidx = cpu_info.llc_map[cpu].cache;516 /* paranoid */ verify(pidx < cpu_info.llc_count);517 518 depart(caches[pidx]);519 arrive(caches[nidx]);520 521 __STATS( /* cpu migs++ */ )522 }523 return proc->rdq.cpu = cpu;524 }525 526 503 // Pop from the ready queue from a given cluster 527 504 __attribute__((hot)) thread$ * pop_fast(struct cluster * cltr) with (cltr->ready_queue) { … … 530 507 531 508 processor * const proc = kernelTLS().this_processor; 532 const int cpu = pop_getcpu( proc, caches ); 533 // const int cpu = __kernel_getcpu(); 509 const int cpu = __kernel_getcpu(); 534 510 /* paranoid */ verify(cpu >= 0); 535 511 /* paranoid */ verify(cpu < cpu_info.hthrd_count); … … 548 524 unsigned long long max = 0; 549 525 for(i; READYQ_SHARD_FACTOR) { 550 unsigned long long tsc = moving_average(ctsc -ts(lanes.data[start + i]), lanes.tscs[start + i].ma);526 unsigned long long tsc = moving_average(ctsc, ts(lanes.data[start + i]), lanes.tscs[start + i].ma); 551 527 if(tsc > max) max = tsc; 552 528 } … … 569 545 unsigned long long max = 0; 570 546 for(i; READYQ_SHARD_FACTOR) { 571 unsigned long long tsc = moving_average(ctsc -ts(lanes.data[start + i]), lanes.tscs[start + i].ma);547 unsigned long long tsc = moving_average(ctsc, ts(lanes.data[start + i]), lanes.tscs[start + i].ma); 572 548 if(tsc > max) max = tsc; 573 549 } … … 577 553 proc->rdq.target = MAX; 578 554 lanes.help[target / READYQ_SHARD_FACTOR].tri++; 579 if(moving_average(ctsc - lanes.tscs[target].tv, lanes.tscs[target].ma) > cutoff) { 580 __STATS( __tls_stats()->ready.pop.helped[target]++; ) 555 if(moving_average(ctsc, lanes.tscs[target].tv, lanes.tscs[target].ma) > cutoff) { 581 556 thread$ * t = try_pop(cltr, target __STATS(, __tls_stats()->ready.pop.help)); 582 557 proc->rdq.last = target; … … 587 562 588 563 unsigned last = proc->rdq.last; 589 if(last != MAX && moving_average(ctsc - lanes.tscs[last].tv, lanes.tscs[last].ma) > cutoff) { 590 __STATS( __tls_stats()->ready.pop.helped[last]++; ) 564 if(last != MAX && moving_average(ctsc, lanes.tscs[last].tv, lanes.tscs[last].ma) > cutoff) { 591 565 thread$ * t = try_pop(cltr, last __STATS(, __tls_stats()->ready.pop.help)); 592 566 if(t) return t;
Note: See TracChangeset
for help on using the changeset viewer.