Changeset fc59df78


Ignore:
Timestamp:
Apr 24, 2021, 7:36:42 PM (7 weeks ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master
Children:
89eff25
Parents:
5c04e82
Message:

Split ready-queue routines in 3 instead of 2.

Location:
libcfa/src/concurrency
Files:
3 edited

Legend:

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

    r5c04e82 rfc59df78  
    488488
    489489        ready_schedule_lock();
    490                 $thread * thrd = pop_slow( this );
     490                $thread * thrd;
     491                for(25) {
     492                        thrd = pop_slow( this );
     493                        if(thrd) goto RET;
     494                }
     495                thrd = pop_search( this );
     496
     497                RET:
    491498        ready_schedule_unlock();
    492499
  • libcfa/src/concurrency/kernel_private.hfa

    r5c04e82 rfc59df78  
    289289
    290290//-----------------------------------------------------------------------
    291 // pop thread from the ready queue of a cluster
     291// pop thread from the local queues of a cluster
    292292// returns 0p if empty
    293293// May return 0p spuriously
     
    295295
    296296//-----------------------------------------------------------------------
    297 // pop thread from the ready queue of a cluster
     297// pop thread from any ready queue of a cluster
     298// returns 0p if empty
     299// May return 0p spuriously
     300__attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr);
     301
     302//-----------------------------------------------------------------------
     303// search all ready queues of a cluster for any thread
    298304// returns 0p if empty
    299305// guaranteed to find any threads added before this call
    300 __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr);
     306__attribute__((hot)) struct $thread * pop_search(struct cluster * cltr);
    301307
    302308//-----------------------------------------------------------------------
  • libcfa/src/concurrency/ready_queue.cfa

    r5c04e82 rfc59df78  
    344344        }
    345345
    346         __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) {
     346        __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) { return pop_fast(cltr); }
     347        __attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) {
    347348                return search(cltr);
    348349        }
     
    436437
    437438        __attribute__((hot)) struct $thread * pop_slow(struct cluster * cltr) with (cltr->ready_queue) {
    438                 for(25) {
    439                         unsigned i = __tls_rand() % lanes.count;
    440                         $thread * t = try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal));
    441                         if(t) return t;
    442                 }
    443 
     439                unsigned i = __tls_rand() % lanes.count;
     440                return try_pop(cltr, i __STATS(, __tls_stats()->ready.pop.steal));
     441        }
     442
     443        __attribute__((hot)) struct $thread * pop_search(struct cluster * cltr) with (cltr->ready_queue) {
    444444                return search(cltr);
    445445        }
Note: See TracChangeset for help on using the changeset viewer.