Changeset d72c074


Ignore:
Timestamp:
Jun 24, 2020, 4:36:20 PM (15 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
564148f
Parents:
29cb302
Message:

Added option to bias threads to queues, instead of processors to queues

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    r29cb302 rd72c074  
    168168                struct $thread * prev;
    169169                volatile unsigned long long ts;
     170                int preferred;
    170171        };
    171172
  • libcfa/src/concurrency/ready_queue.cfa

    r29cb302 rd72c074  
    3737#endif
    3838
    39 #define BIAS 8
     39#define BIAS 64
    4040
    4141// returns the maximum number of processors the RWLock support
     
    221221        #if defined(BIAS) && !defined(__CFA_NO_STATISTICS__)
    222222                bool local = false;
     223                int preferred =
     224                        //*
     225                        kernelTLS.this_processor ? kernelTLS.this_processor->id * 4 : -1;
     226                        /*/
     227                        thrd->link.preferred * 4;
     228                        //*/
     229
     230
    223231        #endif
    224232
     
    231239                        unsigned rlow  = r % BIAS;
    232240                        unsigned rhigh = r / BIAS;
    233                         if((0 != rlow) && kernelTLS.this_processor) {
     241                        if((0 != rlow) && preferred >= 0) {
    234242                                // (BIAS - 1) out of BIAS chances
    235243                                // Use perferred queues
    236                                 unsigned pid = kernelTLS.this_processor->id * 4;
    237                                 i = pid + (rhigh % 4);
     244                                i = preferred + (rhigh % 4);
    238245
    239246                                #if !defined(__CFA_NO_STATISTICS__)
     
    411418        #endif
    412419
     420        // Update the thread bias
     421        thrd->link.preferred = w / 4;
     422
    413423        // return the popped thread
    414424        return thrd;
  • libcfa/src/concurrency/thread.cfa

    r29cb302 rd72c074  
    3838        link.next = 0p;
    3939        link.prev = 0p;
     40        link.preferred = -1;
    4041
    4142        node.next = 0p;
Note: See TracChangeset for help on using the changeset viewer.