Changeset d672350 for libcfa/src/concurrency/kernel.hfa
- Timestamp:
- Mar 21, 2022, 1:44:06 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- a76202d
- Parents:
- ef3c383 (diff), dbe2533 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.hfa
ref3c383 rd672350 48 48 extern struct cluster * mainCluster; 49 49 50 // Processor id, required for scheduling threads 51 52 50 // Coroutine used py processors for the 2-step context switch 53 51 coroutine processorCtx_t { 54 52 struct processor * proc; 55 53 }; 56 54 57 55 struct io_future_t; 56 57 // Information needed for idle sleep 58 58 struct __fd_waitctx { 59 volatile int fd; 59 // semaphore/future like object 60 // values can be 0, 1 or some file descriptor. 61 // 0 - is the default state 62 // 1 - means the proc should wake-up immediately 63 // FD - means the proc is going asleep and should be woken by writing to the FD. 64 volatile int sem; 65 66 // The event FD that corresponds to this processor 67 int evfd; 68 69 // buffer into which the proc will read from evfd 70 // unused if not using io_uring for idle sleep 71 void * rdbuf; 72 73 // future use to track the read of the eventfd 74 // unused if not using io_uring for idle sleep 75 io_future_t * ftr; 60 76 }; 61 77 … … 92 108 struct { 93 109 $io_context * ctx; 94 bool pending; 95 bool dirty; 110 unsigned id; 111 unsigned target; 112 volatile bool pending; 113 volatile bool dirty; 96 114 } io; 97 115 … … 103 121 bool pending_preemption; 104 122 105 // Idle lock (kernel semaphore) 106 int idle_fd; 107 108 // Idle waitctx 123 // context for idle sleep 109 124 struct __fd_waitctx idle_wctx; 110 125 … … 155 170 void ^?{}(__intrusive_lane_t & this); 156 171 157 // Aligned timestamps which are used by the re laxed ready queue172 // Aligned timestamps which are used by the ready queue and io subsystem 158 173 struct __attribute__((aligned(128))) __timestamp_t { 159 174 volatile unsigned long long tv; … … 161 176 }; 162 177 178 static inline void ?{}(__timestamp_t & this) { this.tv = 0; this.ma = 0; } 179 static inline void ^?{}(__timestamp_t &) {} 180 181 163 182 struct __attribute__((aligned(16))) __cache_id_t { 164 183 volatile unsigned id; 165 184 }; 166 167 // Aligned timestamps which are used by the relaxed ready queue168 struct __attribute__((aligned(128))) __help_cnts_t {169 volatile unsigned long long src;170 volatile unsigned long long dst;171 volatile unsigned long long tri;172 };173 174 static inline void ?{}(__timestamp_t & this) { this.tv = 0; this.ma = 0; }175 static inline void ^?{}(__timestamp_t &) {}176 177 struct __attribute__((aligned(128))) __ready_queue_caches_t;178 void ?{}(__ready_queue_caches_t & this);179 void ^?{}(__ready_queue_caches_t & this);180 181 //TODO adjust cache size to ARCHITECTURE182 // Structure holding the ready queue183 struct __ready_queue_t {184 // Data tracking the actual lanes185 // On a seperate cacheline from the used struct since186 // used can change on each push/pop but this data187 // only changes on shrink/grow188 struct {189 // Arary of lanes190 __intrusive_lane_t * volatile data;191 192 // Array of times193 __timestamp_t * volatile tscs;194 195 __cache_id_t * volatile caches;196 197 // Array of stats198 __help_cnts_t * volatile help;199 200 // Number of lanes (empty or not)201 volatile size_t count;202 } lanes;203 };204 205 void ?{}(__ready_queue_t & this);206 void ^?{}(__ready_queue_t & this);207 #if !defined(__CFA_NO_STATISTICS__)208 unsigned cnt(const __ready_queue_t & this, unsigned idx);209 #endif210 185 211 186 // Idle Sleep … … 233 208 // Cluster 234 209 struct __attribute__((aligned(128))) cluster { 235 // Ready queue for threads 236 __ready_queue_t ready_queue; 210 struct { 211 struct { 212 // Arary of subqueues 213 __intrusive_lane_t * data; 214 215 // Time since subqueues were processed 216 __timestamp_t * tscs; 217 218 // Number of subqueue / timestamps 219 size_t count; 220 } readyQ; 221 222 struct { 223 // Array of $io_ 224 $io_context ** data; 225 226 // Time since subqueues were processed 227 __timestamp_t * tscs; 228 229 // Number of I/O subqueues 230 size_t count; 231 } io; 232 233 // Cache each kernel thread belongs to 234 __cache_id_t * caches; 235 } sched; 236 237 // // Ready queue for threads 238 // __ready_queue_t ready_queue; 237 239 238 240 // Name of the cluster
Note:
See TracChangeset
for help on using the changeset viewer.