Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/ready_queue.cfa

    r32c2c5e rbd0bdd37  
    3939#endif
    4040
    41 #define BIAS 16
     41#define BIAS 4
    4242
    4343// returns the maximum number of processors the RWLock support
     
    252252                preferred =
    253253                        //*
    254                         kernelTLS().this_processor ? kernelTLS().this_processor->id * 4 : -1;
     254                        kernelTLS().this_processor ? kernelTLS().this_processor->cltr_id : -1;
    255255                        /*/
    256256                        thrd->link.preferred * 4;
     
    330330        #if defined(BIAS)
    331331                // Don't bother trying locally too much
    332                 preferred = kernelTLS().this_processor->id * 4;
     332                preferred = kernelTLS().this_processor->cltr_id;
    333333        #endif
    334334
     
    352352
    353353                #if !defined(__CFA_NO_STATISTICS__)
    354                         if(locali) {
    355                                 __tls_stats()->ready.pick.pop.local++;
    356                         }
    357                         if(localj) {
     354                        if(locali && localj) {
    358355                                __tls_stats()->ready.pick.pop.local++;
    359356                        }
     
    528525
    529526// Grow the ready queue
    530 void ready_queue_grow  (struct cluster * cltr, int target) {
     527unsigned ready_queue_grow(struct cluster * cltr, int target) {
     528        unsigned preferred;
     529        size_t ncount;
     530
    531531        /* paranoid */ verify( ready_mutate_islocked() );
    532532        __cfadbg_print_safe(ready_queue, "Kernel : Growing ready queue\n");
     
    543543                // Find new count
    544544                // Make sure we always have atleast 1 list
    545                 size_t ncount = target >= 2 ? target * 4: 1;
     545                if(target >= 2) {
     546                        ncount = target * 4;
     547                        preferred = ncount - 4;
     548                } else {
     549                        ncount = 1;
     550                        preferred = 0;
     551                }
    546552
    547553                // Allocate new array (uses realloc and memcpies the data)
     
    578584
    579585        /* paranoid */ verify( ready_mutate_islocked() );
     586        return preferred;
    580587}
    581588
Note: See TracChangeset for help on using the changeset viewer.