- File:
-
- 1 edited
-
libcfa/src/concurrency/kernel.cfa (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/kernel.cfa
r6ddef36 rd3605f8 27 27 extern "C" { 28 28 #include <sys/eventfd.h> 29 #include <sys/uio.h> 29 30 } 30 31 … … 125 126 static void __wake_one(cluster * cltr); 126 127 127 static void idle_sleep(processor * proc, io_future_t & future, char buf[]);128 static void idle_sleep(processor * proc, io_future_t & future, iovec & iov); 128 129 static bool mark_idle (__cluster_proc_list & idles, processor & proc); 129 130 static void mark_awake(__cluster_proc_list & idles, processor & proc); … … 131 132 extern void __cfa_io_start( processor * ); 132 133 extern bool __cfa_io_drain( processor * ); 133 extern bool __cfa_io_flush( processor *, bool wait);134 extern bool __cfa_io_flush( processor *, int min_comp ); 134 135 extern void __cfa_io_stop ( processor * ); 135 136 static inline bool __maybe_io_drain( processor * ); 136 137 137 #if defined( IO_URING_IDLE) && defined(CFA_HAVE_LINUX_IO_URING_H)138 extern bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd);138 #if defined(CFA_WITH_IO_URING_IDLE) 139 extern bool __kernel_read(processor * proc, io_future_t & future, iovec &, int fd); 139 140 #endif 140 141 … … 171 172 io_future_t future; // used for idle sleep when io_uring is present 172 173 future.self.ptr = 1p; // mark it as already fulfilled so we know if there is a pending request or not 173 char buf[sizeof(uint64_t)]; 174 eventfd_t idle_val; 175 iovec idle_iovec = { &idle_val, sizeof(idle_val) }; 174 176 175 177 __cfa_io_start( this ); … … 206 208 207 209 if( !readyThread ) { 208 __cfa_io_flush( this, false);210 __cfa_io_flush( this, 0 ); 209 211 210 212 readyThread = __next_thread_slow( this->cltr ); … … 237 239 } 238 240 239 idle_sleep( this, future, buf);241 idle_sleep( this, future, idle_iovec ); 240 242 241 243 // We were woken up, remove self from idle … … 258 260 259 261 if(this->io.pending && !this->io.dirty) { 260 __cfa_io_flush( this, false);262 __cfa_io_flush( this, 0 ); 261 263 } 262 264 … … 274 276 275 277 // If we can't find a thread, might as well flush any outstanding I/O 276 if(this->io.pending) { __cfa_io_flush( this, false); }278 if(this->io.pending) { __cfa_io_flush( this, 0 ); } 277 279 278 280 // Spin a little on I/O, just in case … … 369 371 370 372 if(this->io.pending && !this->io.dirty) { 371 __cfa_io_flush( this, false);373 __cfa_io_flush( this, 0 ); 372 374 } 373 375 … … 379 381 380 382 __cfadbg_print_safe(runtime_core, "Kernel : core %p stopping\n", this); 383 } 384 385 for(int i = 0; !available(future); i++) { 386 if(i > 1000) __cfaabi_dbg_write( "ERROR: kernel has bin spinning on a flush after exit loop.\n", 60); 387 __cfa_io_flush( this, 1 ); 381 388 } 382 389 … … 779 786 } 780 787 781 static void idle_sleep(processor * this, io_future_t & future, char buf[]) {782 #if !defined( IO_URING_IDLE) || !defined(CFA_HAVE_LINUX_IO_URING_H)788 static void idle_sleep(processor * this, io_future_t & future, iovec & iov) { 789 #if !defined(CFA_WITH_IO_URING_IDLE) 783 790 #if !defined(__CFA_NO_STATISTICS__) 784 791 if(this->print_halts) { … … 813 820 #endif 814 821 #else 815 #if !defined(CFA_HAVE_IORING_OP_READ)816 #error this is only implemented if the read is present817 #endif818 822 // Do we already have a pending read 819 823 if(available(future)) { … … 821 825 reset(future); 822 826 823 __kernel_read(this, future, buf, this->idle_fd );824 } 825 826 __cfa_io_flush( this, true);827 __kernel_read(this, future, iov, this->idle_fd ); 828 } 829 830 __cfa_io_flush( this, 1 ); 827 831 #endif 828 832 }
Note:
See TracChangeset
for help on using the changeset viewer.