Changeset df7597e0


Ignore:
Timestamp:
Jun 17, 2021, 10:32:53 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
07b4970
Parents:
cf85f96
Message:

Fix the cpu-based ready to actually use cpu_info
rather then being a stupider work stealing approach.

File:
1 edited

Legend:

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

    rcf85f96 rdf7597e0  
    256256                /* paranoid */ verify(cpu * READYQ_SHARD_FACTOR < lanes.count);
    257257
    258                 const int start = cpu * READYQ_SHARD_FACTOR;
     258                const cpu_map_entry_t & map = cpu_info.llc_map[cpu];
     259                /* paranoid */ verify(map.start * READYQ_SHARD_FACTOR < lanes.count);
     260                /* paranoid */ verify(map.self * READYQ_SHARD_FACTOR < lanes.count);
     261                /* paranoid */ verifyf((map.start + map.count) * READYQ_SHARD_FACTOR <= lanes.count, "have %u lanes but map can go up to %u", lanes.count, (map.start + map.count) * READYQ_SHARD_FACTOR);
     262
     263                const int start = map.self * READYQ_SHARD_FACTOR;
    259264                unsigned i;
    260265                do {
     
    288293                const int cpu = __kernel_getcpu();
    289294                /* paranoid */ verify(cpu >= 0);
     295                /* paranoid */ verify(cpu < cpu_info.hthrd_count);
    290296                /* paranoid */ verify(cpu * READYQ_SHARD_FACTOR < lanes.count);
    291                 /* paranoid */ verify(cpu < cpu_info.hthrd_count);
     297
     298                const cpu_map_entry_t & map = cpu_info.llc_map[cpu];
     299                /* paranoid */ verify(map.start * READYQ_SHARD_FACTOR < lanes.count);
     300                /* paranoid */ verify(map.self * READYQ_SHARD_FACTOR < lanes.count);
     301                /* paranoid */ verifyf((map.start + map.count) * READYQ_SHARD_FACTOR <= lanes.count, "have %u lanes but map can go up to %u", lanes.count, (map.start + map.count) * READYQ_SHARD_FACTOR);
    292302
    293303                processor * const proc = kernelTLS().this_processor;
    294                 const int start = cpu * READYQ_SHARD_FACTOR;
     304                const int start = map.self * READYQ_SHARD_FACTOR;
    295305
    296306                // Did we already have a help target
     
    303313                        }
    304314                        proc->rdq.cutoff = min;
    305                         proc->rdq.target = __tls_rand() % lanes.count;
     315                        proc->rdq.target = (map.start * READYQ_SHARD_FACTOR) + (__tls_rand() % (map.count* READYQ_SHARD_FACTOR));
    306316                }
    307317                else {
Note: See TracChangeset for help on using the changeset viewer.