Ignore:
Timestamp:
Jan 17, 2022, 7:47:29 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
f55f110
Parents:
25337e0
Message:

@optim: maximize chances "cache" array stays in cache.

File:
1 edited

Legend:

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

    r25337e0 r0fb3ee5  
    399399                /* paranoid */ verify(cpu < cpu_info.hthrd_count);
    400400                unsigned this_cache = cpu_info.llc_map[cpu].cache;
    401                 __atomic_store_n(&lanes.caches[this / READYQ_SHARD_FACTOR].id, this_cache, __ATOMIC_RELAXED);
     401
     402                // Super important: don't write the same value over and over again
     403                // We want to maximise our chances that his particular values stays in cache
     404                if(lanes.caches[this / READYQ_SHARD_FACTOR].id != this_cache)
     405                        __atomic_store_n(&lanes.caches[this / READYQ_SHARD_FACTOR].id, this_cache, __ATOMIC_RELAXED);
    402406
    403407                const unsigned long long ctsc = rdtscl();
Note: See TracChangeset for help on using the changeset viewer.