Changes in libcfa/src/concurrency/io.cfa [70b4aeb9:d529ad0]
- File:
-
- 1 edited
-
libcfa/src/concurrency/io.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r70b4aeb9 rd529ad0 175 175 /* paranoid */ verify( ! __preemption_enabled() ); 176 176 177 ctx.proc->io.pending = false;177 __atomic_store_n(&ctx.proc->io.pending, false, __ATOMIC_RELAXED); 178 178 } 179 179 … … 287 287 //============================================================================================= 288 288 // submission 289 static inline void __submit ( struct $io_context * ctx, __u32 idxs[], __u32 have, bool lazy) {289 static inline void __submit_only( struct $io_context * ctx, __u32 idxs[], __u32 have) { 290 290 // We can proceed to the fast path 291 291 // Get the right objects … … 304 304 sq.to_submit += have; 305 305 306 ctx->proc->io.pending = true; 307 ctx->proc->io.dirty = true; 306 __atomic_store_n(&ctx->proc->io.pending, true, __ATOMIC_RELAXED); 307 __atomic_store_n(&ctx->proc->io.dirty , true, __ATOMIC_RELAXED); 308 } 309 310 static inline void __submit( struct $io_context * ctx, __u32 idxs[], __u32 have, bool lazy) { 311 __sub_ring_t & sq = ctx->sq; 312 __submit_only(ctx, idxs, have); 313 308 314 if(sq.to_submit > 30) { 309 315 __tls_stats()->io.flush.full++; … … 402 408 // I/O Arbiter 403 409 //============================================================================================= 404 static inline void block(__outstanding_io_queue & queue, __outstanding_io & item) { 410 static inline bool enqueue(__outstanding_io_queue & queue, __outstanding_io & item) { 411 bool was_empty; 412 405 413 // Lock the list, it's not thread safe 406 414 lock( queue.lock __cfaabi_dbg_ctx2 ); 407 415 { 416 was_empty = empty(queue.queue); 417 408 418 // Add our request to the list 409 419 add( queue.queue, item ); … … 414 424 unlock( queue.lock ); 415 425 416 wait( item.sem );426 return was_empty; 417 427 } 418 428 … … 432 442 pa.want = want; 433 443 434 block(this.pending, (__outstanding_io&)pa); 444 enqueue(this.pending, (__outstanding_io&)pa); 445 446 wait( pa.sem ); 435 447 436 448 return pa.ctx; … … 485 497 ei.lazy = lazy; 486 498 487 block(ctx->ext_sq, (__outstanding_io&)ei); 499 bool we = enqueue(ctx->ext_sq, (__outstanding_io&)ei); 500 501 __atomic_store_n(&ctx->proc->io.pending, true, __ATOMIC_SEQ_CST); 502 503 if( we ) { 504 sigval_t value = { PREEMPT_IO }; 505 pthread_sigqueue(ctx->proc->kernel_thread, SIGUSR1, value); 506 } 507 508 wait( ei.sem ); 488 509 489 510 __cfadbg_print_safe(io, "Kernel I/O : %u submitted from arbiter\n", have); … … 501 522 __external_io & ei = (__external_io&)drop( ctx.ext_sq.queue ); 502 523 503 __submit (&ctx, ei.idxs, ei.have, ei.lazy);524 __submit_only(&ctx, ei.idxs, ei.have); 504 525 505 526 post( ei.sem );
Note:
See TracChangeset
for help on using the changeset viewer.