- Timestamp:
- Sep 23, 2021, 2:43:44 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 716b62c, 814f87d
- Parents:
- 24e321c
- Location:
- libcfa/src/concurrency
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/clib/cfathread.cfa
r24e321c r75c7252 129 129 for(i; ret) { 130 130 thread$ * thrd = (thread$ *)events[i].data.u64; 131 unpark( thrd );131 unpark( thrd, UNPARK_REMOTE ); 132 132 } 133 133 } … … 158 158 } 159 159 160 poller_cnt = 2 4;160 poller_cnt = 2; 161 161 poller_fds = alloc(poller_cnt); 162 162 pollers = alloc(poller_cnt); -
libcfa/src/concurrency/ready_queue.cfa
r24e321c r75c7252 100 100 #define __kernel_rseq_unregister rseq_unregister_current_thread 101 101 #elif defined(CFA_HAVE_LINUX_RSEQ_H) 102 void __kernel_raw_rseq_register (void);103 void __kernel_raw_rseq_unregister(void);102 static void __kernel_raw_rseq_register (void); 103 static void __kernel_raw_rseq_unregister(void); 104 104 105 105 #define __kernel_rseq_register __kernel_raw_rseq_register … … 294 294 295 295 processor * const proc = kernelTLS().this_processor; 296 const bool external = !push_local || (!proc) || (cltr != proc->cltr); 297 296 const bool external = (!proc) || (cltr != proc->cltr); 297 298 // Figure out the current cpu and make sure it is valid 298 299 const int cpu = __kernel_getcpu(); 299 300 /* paranoid */ verify(cpu >= 0); … … 301 302 /* paranoid */ verify(cpu * READYQ_SHARD_FACTOR < lanes.count); 302 303 303 const cpu_map_entry_t & map = cpu_info.llc_map[cpu]; 304 // Figure out where thread was last time and make sure it's 305 /* paranoid */ verify(thrd->preferred >= 0); 306 /* paranoid */ verify(thrd->preferred < cpu_info.hthrd_count); 307 /* paranoid */ verify(thrd->preferred * READYQ_SHARD_FACTOR < lanes.count); 308 const int prf = thrd->preferred * READYQ_SHARD_FACTOR; 309 310 const cpu_map_entry_t & map; 311 choose(hint) { 312 case UNPARK_LOCAL : &map = &cpu_info.llc_map[cpu]; 313 case UNPARK_REMOTE: &map = &cpu_info.llc_map[prf]; 314 } 304 315 /* paranoid */ verify(map.start * READYQ_SHARD_FACTOR < lanes.count); 305 316 /* paranoid */ verify(map.self * READYQ_SHARD_FACTOR < lanes.count); … … 312 323 if(unlikely(external)) { r = __tls_rand(); } 313 324 else { r = proc->rdq.its++; } 314 i = start + (r % READYQ_SHARD_FACTOR); 325 choose(hint) { 326 case UNPARK_LOCAL : i = start + (r % READYQ_SHARD_FACTOR); 327 case UNPARK_REMOTE: i = prf + (r % READYQ_SHARD_FACTOR); 328 } 315 329 // If we can't lock it retry 316 330 } while( !__atomic_try_acquire( &lanes.data[i].lock ) ); … … 965 979 extern void __enable_interrupts_hard(); 966 980 967 void __kernel_raw_rseq_register (void) {981 static void __kernel_raw_rseq_register (void) { 968 982 /* paranoid */ verify( __cfaabi_rseq.cpu_id == RSEQ_CPU_ID_UNINITIALIZED ); 969 983 … … 983 997 } 984 998 985 void __kernel_raw_rseq_unregister(void) {999 static void __kernel_raw_rseq_unregister(void) { 986 1000 /* paranoid */ verify( __cfaabi_rseq.cpu_id >= 0 ); 987 1001
Note: See TracChangeset
for help on using the changeset viewer.