Changeset c7b2215 for libcfa/src/concurrency
- Timestamp:
- Nov 29, 2021, 12:50:31 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- a1f3d93
- Parents:
- ddd2ec9
- Location:
- libcfa/src/concurrency
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
rddd2ec9 rc7b2215 133 133 } 134 134 135 bool __cfa_io_flush( processor * proc, bool wait) {135 bool __cfa_io_flush( processor * proc, int min_comp ) { 136 136 /* paranoid */ verify( ! __preemption_enabled() ); 137 137 /* paranoid */ verify( proc ); … … 144 144 145 145 __STATS__( true, io.calls.flush++; ) 146 int ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, wait ? 1 : 0,0, (sigset_t *)0p, _NSIG / 8);146 int ret = syscall( __NR_io_uring_enter, ctx.fd, ctx.sq.to_submit, min_comp, min_comp > 0 ? IORING_ENTER_GETEVENTS : 0, (sigset_t *)0p, _NSIG / 8); 147 147 if( ret < 0 ) { 148 148 switch((int)errno) { … … 302 302 ctx->proc->io.dirty = true; 303 303 if(sq.to_submit > 30 || !lazy) { 304 __cfa_io_flush( ctx->proc, false);304 __cfa_io_flush( ctx->proc, 0 ); 305 305 } 306 306 } … … 521 521 sqe->flags = 0; 522 522 sqe->ioprio = 0; 523 sqe->fd = 0;523 sqe->fd = fd; 524 524 sqe->off = 0; 525 525 sqe->fsync_flags = 0; -
libcfa/src/concurrency/io/setup.cfa
rddd2ec9 rc7b2215 32 32 33 33 void __cfa_io_start( processor * proc ) {} 34 bool __cfa_io_flush( processor * proc, bool) {}34 bool __cfa_io_flush( processor * proc, int ) {} 35 35 void __cfa_io_stop ( processor * proc ) {} 36 36 -
libcfa/src/concurrency/kernel.cfa
rddd2ec9 rc7b2215 125 125 static void __wake_one(cluster * cltr); 126 126 127 static void idle_sleep(processor * proc, io_future_t & future, char buf[]);127 static void idle_sleep(processor * proc, io_future_t & future, eventfd_t & val); 128 128 static bool mark_idle (__cluster_proc_list & idles, processor & proc); 129 129 static void mark_awake(__cluster_proc_list & idles, processor & proc); … … 131 131 extern void __cfa_io_start( processor * ); 132 132 extern bool __cfa_io_drain( processor * ); 133 extern bool __cfa_io_flush( processor *, bool wait);133 extern bool __cfa_io_flush( processor *, int min_comp ); 134 134 extern void __cfa_io_stop ( processor * ); 135 135 static inline bool __maybe_io_drain( processor * ); … … 169 169 io_future_t future; // used for idle sleep when io_uring is present 170 170 future.self.ptr = 1p; // mark it as already fulfilled so we know if there is a pending request or not 171 char buf[sizeof(uint64_t)];171 eventfd_t idle_val; 172 172 173 173 __cfa_io_start( this ); … … 204 204 205 205 if( !readyThread ) { 206 __cfa_io_flush( this, false);206 __cfa_io_flush( this, 0 ); 207 207 208 208 readyThread = __next_thread_slow( this->cltr ); … … 235 235 } 236 236 237 idle_sleep( this, future, buf);237 idle_sleep( this, future, idle_val ); 238 238 239 239 // We were woken up, remove self from idle … … 256 256 257 257 if(this->io.pending && !this->io.dirty) { 258 __cfa_io_flush( this, false);258 __cfa_io_flush( this, 0 ); 259 259 } 260 260 … … 272 272 273 273 // If we can't find a thread, might as well flush any outstanding I/O 274 if(this->io.pending) { __cfa_io_flush( this, false); }274 if(this->io.pending) { __cfa_io_flush( this, 0 ); } 275 275 276 276 // Spin a little on I/O, just in case … … 367 367 368 368 if(this->io.pending && !this->io.dirty) { 369 __cfa_io_flush( this, false);369 __cfa_io_flush( this, 0 ); 370 370 } 371 371 … … 777 777 } 778 778 779 static void idle_sleep(processor * this, io_future_t & future, char buf[]) {779 static void idle_sleep(processor * this, io_future_t & future, eventfd_t & val) { 780 780 #if !defined(IO_URING_IDLE) || !defined(CFA_HAVE_LINUX_IO_URING_H) 781 781 #if !defined(__CFA_NO_STATISTICS__) … … 819 819 reset(future); 820 820 821 __kernel_read(this, future, buf, this->idle_fd );822 } 823 824 __cfa_io_flush( this, true);821 __kernel_read(this, future, (char *)&val, this->idle_fd ); 822 } 823 824 __cfa_io_flush( this, 1 ); 825 825 #endif 826 826 }
Note: See TracChangeset
for help on using the changeset viewer.