Ignore:
Timestamp:
Jul 24, 2020, 1:11:39 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
39fc03e
Parents:
f4ec4a90
Message:

Changed ready_queue_(grow/shrink) to take a target instead of going incrementing

File:
1 edited

Legend:

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

    rf4ec4a90 r320ec6fc  
    3737#endif
    3838
    39 #define BIAS 64
     39#define BIAS 16
    4040
    4141// returns the maximum number of processors the RWLock support
     
    500500
    501501// Grow the ready queue
    502 void ready_queue_grow  (struct cluster * cltr) {
     502void ready_queue_grow  (struct cluster * cltr, int target) {
    503503        /* paranoid */ verify( ready_mutate_islocked() );
    504504        __cfadbg_print_safe(ready_queue, "Kernel : Growing ready queue\n");
     
    515515                // increase count
    516516                ncount += 4;
     517                /* paranoid */ verify( ncount == target * 4 || target < 2 );
    517518
    518519                // Allocate new array (uses realloc and memcpies the data)
     
    550551
    551552// Shrink the ready queue
    552 void ready_queue_shrink(struct cluster * cltr) {
     553void ready_queue_shrink(struct cluster * cltr, int target) {
    553554        /* paranoid */ verify( ready_mutate_islocked() );
    554555        __cfadbg_print_safe(ready_queue, "Kernel : Shrinking ready queue\n");
     
    566567                // reduce the actual count so push doesn't use the old queues
    567568                lanes.count -= 4;
    568                 verify(ocount > lanes.count);
     569                /* paranoid */ verify( ocount > lanes.count );
     570                /* paranoid */ verify( lanes.count == target * 4 || target < 2 );
    569571
    570572                // for printing count the number of displaced threads
Note: See TracChangeset for help on using the changeset viewer.