Changeset 37ba662


Ignore:
Timestamp:
Jun 16, 2020, 3:32:00 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
04b5cef
Parents:
2073d207
Message:

Minor improvements to alignments and memory layout

Location:
libcfa/src/concurrency
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/invoke.h

    r2073d207 r37ba662  
    182182                //SKULLDUGGERY errno is not save in the thread data structure because returnToKernel appears to be the only function to require saving and restoring it
    183183
    184                 // coroutine body used to store context
    185                 struct $coroutine  self_cor;
    186 
    187                 // current active context
    188                 struct $coroutine * curr_cor;
    189 
    190                 // monitor body used for mutual exclusion
    191                 struct $monitor    self_mon;
    192 
    193                 // pointer to monitor with sufficient lifetime for current monitors
    194                 struct $monitor *  self_mon_p;
    195 
    196184                // pointer to the cluster on which the thread is running
    197185                struct cluster * curr_cluster;
    198 
    199                 // monitors currently held by this thread
    200                 struct __monitor_group_t monitors;
    201186
    202187                // Link lists fields
    203188                // instrusive link field for threads
    204189                struct __thread_desc_link link;
     190
     191                // coroutine body used to store context
     192                struct $coroutine  self_cor;
     193
     194                // current active context
     195                struct $coroutine * curr_cor;
     196
     197                // monitor body used for mutual exclusion
     198                struct $monitor    self_mon;
     199
     200                // pointer to monitor with sufficient lifetime for current monitors
     201                struct $monitor *  self_mon_p;
     202
     203                // monitors currently held by this thread
     204                struct __monitor_group_t monitors;
    205205
    206206                struct {
  • libcfa/src/concurrency/kernel.hfa

    r2073d207 r37ba662  
    6161
    6262// Wrapper around kernel threads
    63 struct processor {
     63struct __attribute__((aligned(128))) processor {
     64        // Main state
    6465        inline __processor_id_t;
    6566
    66         // Main state
     67        // Cluster from which to get threads
     68        struct cluster * cltr;
     69
     70        // Set to true to notify the processor should terminate
     71        volatile bool do_terminate;
     72
    6773        // Coroutine ctx who does keeps the state of the processor
    6874        struct processorCtx_t runner;
    69 
    70         // Cluster from which to get threads
    71         struct cluster * cltr;
    7275
    7376        // Name of the processor
     
    9093        // Idle lock (kernel semaphore)
    9194        __bin_sem_t idle;
    92 
    93         // Termination
    94         // Set to true to notify the processor should terminate
    95         volatile bool do_terminate;
    9695
    9796        // Termination synchronisation (user semaphore)
     
    153152//TODO adjust cache size to ARCHITECTURE
    154153// Structure holding the relaxed ready queue
    155 struct __attribute__((aligned(128))) __ready_queue_t {
     154struct __ready_queue_t {
    156155        // Data tracking how many/which lanes are used
    157156        // Aligned to 128 for cache locality
     
    162161        // used can change on each push/pop but this data
    163162        // only changes on shrink/grow
    164         struct __attribute__((aligned(64))) {
     163        struct {
    165164                // Arary of lanes
    166165                __intrusive_lane_t * volatile data;
     
    176175//-----------------------------------------------------------------------------
    177176// Cluster
    178 struct cluster {
     177struct __attribute__((aligned(128))) cluster {
    179178        // Ready queue for threads
    180179        __ready_queue_t ready_queue;
  • libcfa/src/concurrency/kernel_private.hfa

    r2073d207 r37ba662  
    2626// Scheduler
    2727
    28 struct __attribute__((aligned(64))) __scheduler_lock_id_t;
     28struct __attribute__((aligned(128))) __scheduler_lock_id_t;
    2929
    3030extern "C" {
     
    111111// Cells use by the reader writer lock
    112112// while not generic it only relies on a opaque pointer
    113 struct __attribute__((aligned(64))) __scheduler_lock_id_t {
     113struct __attribute__((aligned(128))) __scheduler_lock_id_t {
    114114        __processor_id_t * volatile handle;
    115115        volatile bool lock;
  • libcfa/src/concurrency/ready_queue.cfa

    r2073d207 r37ba662  
    120120        // Return new spot.
    121121        /*paranoid*/ verify(n < ready);
    122         /*paranoid*/ verify(__alignof__(data[n]) == cache_line_size);
     122        /*paranoid*/ verify(__alignof__(data[n]) == (2 * cache_line_size));
    123123        /*paranoid*/ verify((((uintptr_t)&data[n]) % cache_line_size) == 0);
    124124        return n;
  • libcfa/src/concurrency/stats.hfa

    r2073d207 r37ba662  
    6666        #endif
    6767
    68         struct __stats_t {
     68        struct __attribute__((aligned(128))) __stats_t {
    6969                __stats_readQ_t ready;
    7070                #if defined(HAVE_LINUX_IO_URING_H)
Note: See TracChangeset for help on using the changeset viewer.