Ignore:
Timestamp:
Apr 15, 2021, 4:01:50 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
3531e09
Parents:
e2cc3c7
Message:

Removed snzi from ready queue.
It hasn't been used in a while and I don't expect to ever use it again.
Left the files in incase it's useful for something else.

File:
1 edited

Legend:

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

    re2cc3c7 r78d6c803  
    1717// #define __CFA_DEBUG_PRINT_READY_QUEUE__
    1818
    19 // #define USE_SNZI
    2019// #define USE_MPSC
    2120
     
    2928#include <unistd.h>
    3029
    31 #include "snzi.hfa"
    3230#include "ready_subqueue.hfa"
    3331
     
    202200void ^?{}(__ready_queue_t & this) with (this) {
    203201        verify( 1 == lanes.count );
    204         #ifdef USE_SNZI
    205                 verify( !query( snzi ) );
    206         #endif
    207202        free(lanes.data);
    208203}
     
    210205//-----------------------------------------------------------------------
    211206__attribute__((hot)) bool query(struct cluster * cltr) {
    212         #ifdef USE_SNZI
    213                 return query(cltr->ready_queue.snzi);
    214         #endif
    215207        return true;
    216208}
     
    293285
    294286        // Actually push it
    295         #ifdef USE_SNZI
    296                 bool lane_first =
    297         #endif
    298 
    299287        push(lanes.data[i], thrd);
    300 
    301         #ifdef USE_SNZI
    302                 // If this lane used to be empty we need to do more
    303                 if(lane_first) {
    304                         // Check if the entire queue used to be empty
    305                         first = !query(snzi);
    306 
    307                         // Update the snzi
    308                         arrive( snzi, i );
    309                 }
    310         #endif
    311288
    312289        #if !defined(USE_MPSC)
     
    351328
    352329        // As long as the list is not empty, try finding a lane that isn't empty and pop from it
    353         #ifdef USE_SNZI
    354                 while( query(snzi) ) {
    355         #else
    356                 for(25) {
    357         #endif
     330        for(25) {
    358331                // Pick two lists at random
    359332                // unsigned ri = __tls_rand();
     
    447420        /* paranoid */ verify(lane.lock);
    448421
    449         #ifdef USE_SNZI
    450                 // If this was the last element in the lane
    451                 if(emptied) {
    452                         depart( snzi, w );
    453                 }
    454         #endif
    455 
    456422        // Unlock and return
    457423        __atomic_unlock(&lane.lock);
     
    484450
    485451                                removed = true;
    486                                 #ifdef USE_SNZI
    487                                         if(emptied) {
    488                                                 depart( snzi, i );
    489                                         }
    490                                 #endif
    491452                        }
    492453                __atomic_unlock(&lane.lock);
     
    571532        // grow the ready queue
    572533        with( cltr->ready_queue ) {
    573                 #ifdef USE_SNZI
    574                         ^(snzi){};
    575                 #endif
    576 
    577534                // Find new count
    578535                // Make sure we always have atleast 1 list
     
    598555                // Update original
    599556                lanes.count = ncount;
    600 
    601                 #ifdef USE_SNZI
    602                         // Re-create the snzi
    603                         snzi{ log2( lanes.count / 8 ) };
    604                         for( idx; (size_t)lanes.count ) {
    605                                 if( !is_empty(lanes.data[idx]) ) {
    606                                         arrive(snzi, idx);
    607                                 }
    608                         }
    609                 #endif
    610557        }
    611558
     
    631578
    632579        with( cltr->ready_queue ) {
    633                 #ifdef USE_SNZI
    634                         ^(snzi){};
    635                 #endif
    636 
    637580                // Remember old count
    638581                size_t ocount = lanes.count;
     
    685628                        fix(lanes.data[idx]);
    686629                }
    687 
    688                 #ifdef USE_SNZI
    689                         // Re-create the snzi
    690                         snzi{ log2( lanes.count / 8 ) };
    691                         for( idx; (size_t)lanes.count ) {
    692                                 if( !is_empty(lanes.data[idx]) ) {
    693                                         arrive(snzi, idx);
    694                                 }
    695                         }
    696                 #endif
    697630        }
    698631
Note: See TracChangeset for help on using the changeset viewer.