Changes in / [7d51ef8:1e5cd9a]


Ignore:
Location:
libcfa/src/concurrency
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel/startup.cfa

    r7d51ef8 r1e5cd9a  
    496496        this.rdq.id  = -1u;
    497497        this.rdq.target = -1u;
    498         this.rdq.cutoff = -1ull;
     498        this.rdq.cutoff = 0ull;
    499499        do_terminate = false;
    500500        preemption_alarm = 0p;
  • libcfa/src/concurrency/ready_queue.cfa

    r7d51ef8 r1e5cd9a  
    398398
    399399                if(proc->rdq.target == -1u) {
    400                         _Static_assert(READYQ_SHARD_FACTOR == 2);
    401                         unsigned idx1 = proc->rdq.id + 0;
    402                         unsigned idx2 = proc->rdq.id + 1;
    403                         unsigned long long tsc1 = ts(lanes.data[idx1]);
    404                         unsigned long long tsc2 = ts(lanes.data[idx2]);
     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;
    405406                        proc->rdq.target = __tls_rand() % lanes.count;
    406 
    407                         // WARNING: std::min is polymorphic and therefore causes 500% slowdown instead of the expected 2%
    408                         proc->rdq.cutoff = tsc1 < tsc2 ? tsc1 : tsc2;
    409407                }
    410408                else {
Note: See TracChangeset for help on using the changeset viewer.