Ignore:
Timestamp:
Jun 11, 2020, 3:15:13 PM (17 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
b388ee8
Parents:
ab8a023
Message:

Replaced the bitmask approached for the ready-queue with a SNZI

File:
1 edited

Legend:

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

    rab8a023 r61d7bec  
    156156
    157157// Intrusives lanes which are used by the relaxed ready queue
    158 struct __attribute__((aligned(128))) __intrusive_lane_t {
    159         // spin lock protecting the queue
    160         volatile bool lock;
    161 
    162         // anchor for the head and the tail of the queue
    163         struct __sentinel_t {
    164                 // Link lists fields
    165                 // instrusive link field for threads
    166                 // must be exactly as in $thread
    167                 __thread_desc_link link;
    168         } before, after;
    169 
    170 #if defined(__CFA_WITH_VERIFY__)
    171         // id of last processor to acquire the lock
    172         // needed only to check for mutual exclusion violations
    173         unsigned int last_id;
    174 
    175         // number of items on this list
    176         // needed only to check for deadlocks
    177         unsigned int count;
    178 #endif
    179 
    180         // Optional statistic counters
    181         #if !defined(__CFA_NO_SCHED_STATS__)
    182                 struct __attribute__((aligned(64))) {
    183                         // difference between number of push and pops
    184                         ssize_t diff;
    185 
    186                         // total number of pushes and pops
    187                         size_t  push;
    188                         size_t  pop ;
    189                 } stat;
    190         #endif
    191 };
    192 
     158struct __attribute__((aligned(128))) __intrusive_lane_t;
    193159void  ?{}(__intrusive_lane_t & this);
    194160void ^?{}(__intrusive_lane_t & this);
    195161
    196 typedef unsigned long long __cfa_readyQ_mask_t;
    197 
    198 // enum {
    199 //      __cfa_ready_queue_mask_size = (64 - sizeof(size_t)) / sizeof(size_t),
    200 //      __cfa_max_ready_queues = __cfa_ready_queue_mask_size * 8 * sizeof(size_t)
    201 // };
    202 
    203 #define __cfa_lane_mask_size ((64 - sizeof(size_t)) / sizeof(__cfa_readyQ_mask_t))
    204 #define __cfa_max_lanes (__cfa_lane_mask_size * 8 * sizeof(__cfa_readyQ_mask_t))
     162// Counter used for wether or not the lanes are all empty
     163struct __attribute__((aligned(128))) __snzi_node_t;
     164struct __snzi_t {
     165        unsigned mask;
     166        int root;
     167        __snzi_node_t * nodes;
     168};
     169
     170void  ?{}( __snzi_t & this, unsigned depth );
     171void ^?{}( __snzi_t & this );
    205172
    206173//TODO adjust cache size to ARCHITECTURE
     
    209176        // Data tracking how many/which lanes are used
    210177        // Aligned to 128 for cache locality
    211         struct {
    212                 // number of non-empty lanes
    213                 volatile size_t count;
    214 
    215                 // bit mask, set bits indentify which lanes are non-empty
    216                 volatile __cfa_readyQ_mask_t mask[ __cfa_lane_mask_size ];
    217         } used;
     178        __snzi_t snzi;
    218179
    219180        // Data tracking the actual lanes
     
    231192        // Statistics
    232193        #if !defined(__CFA_NO_STATISTICS__)
    233                 __attribute__((aligned(64))) struct {
     194                struct __attribute__((aligned(64))) {
    234195                        struct {
    235196                                // Push statistic
Note: See TracChangeset for help on using the changeset viewer.