Ignore:
Timestamp:
Mar 14, 2022, 2:24:51 PM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
Children:
bfb9bf5
Parents:
c42b8a1
Message:

Change how the ready queue is initialized to make it common with I/O

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel_private.hfa

    rc42b8a1 r884f3f67  
    366366
    367367//-----------------------------------------------------------------------
     368// Decrease the width of the ready queue (number of lanes) by 4
     369void ready_queue_close(struct cluster * cltr);
     370
     371//-----------------------------------------------------------------------
    368372// Calc moving average based on existing average, before and current time.
    369373static inline unsigned long long moving_average(unsigned long long currtsc, unsigned long long instsc, unsigned long long old_avg) {
     
    380384}
    381385
    382 static const unsigned __readyq_shard_factor = 2;
     386//-----------------------------------------------------------------------
     387// Calc age a timestamp should be before needing help.
     388forall(Data_t * | { unsigned long long ts(Data_t & this); })
     389static inline unsigned long long calc_cutoff(
     390        const unsigned long long ctsc,
     391        const processor * proc,
     392        size_t count,
     393        Data_t * data,
     394        __timestamp_t * tscs,
     395        const unsigned shard_factor
     396) {
     397        unsigned start = proc->rdq.id;
     398        unsigned long long max = 0;
     399        for(i; shard_factor) {
     400                unsigned long long ptsc = ts(data[start + i]);
     401                if(ptsc != -1ull) {
     402                        /* paranoid */ verify( start + i < count );
     403                        unsigned long long tsc = moving_average(ctsc, ptsc, tscs[start + i].ma);
     404                        if(tsc > max) max = tsc;
     405                }
     406        }
     407        return (max + 2 * max) / 2;
     408}
     409
     410static struct {
     411        const unsigned readyq;
     412} __shard_factor = { 2 };
    383413
    384414// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.