- File:
-
- 1 edited
-
libcfa/src/concurrency/preemption.cfa (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/preemption.cfa
re84ab3d rbecb85b9 251 251 bool enabled = __cfaabi_tls.preemption_state.enabled; 252 252 253 // Check if there is a pending preemption 254 processor * proc = __cfaabi_tls.this_processor; 255 bool pending = proc ? proc->pending_preemption : false; 256 if( enabled && pending ) proc->pending_preemption = false; 257 253 258 // create a assembler label after 254 259 // marked as clobber all to avoid movement 255 260 __cfaasm_label(check, after); 261 262 // If we can preempt and there is a pending one 263 // this is a good time to yield 264 if( enabled && pending ) { 265 force_yield( __POLL_PREEMPTION ); 266 } 256 267 return enabled; 257 268 } … … 282 293 // marked as clobber all to avoid movement 283 294 __cfaasm_label(get, after); 295 296 // This is used everywhere, to avoid cost, we DO NOT poll pending preemption 284 297 return val; 285 298 } … … 358 371 if(!ready) { abort("Preemption should be ready"); } 359 372 360 __cfaasm_label(debug, before);373 // __cfaasm_label(debug, before); 361 374 362 375 sigset_t oldset; … … 377 390 if(ret == 1) { abort("ERROR SIGTERM is disabled"); } 378 391 379 __cfaasm_label(debug, after);392 // __cfaasm_label(debug, after); 380 393 } 381 394 … … 548 561 __cfaasm_label( check ); 549 562 __cfaasm_label( dsable ); 550 __cfaasm_label( debug );563 // __cfaasm_label( debug ); 551 564 552 565 // Check if preemption is safe … … 555 568 if( __cfaasm_in( ip, check ) ) { ready = false; goto EXIT; }; 556 569 if( __cfaasm_in( ip, dsable ) ) { ready = false; goto EXIT; }; 557 if( __cfaasm_in( ip, debug ) ) { ready = false; goto EXIT; };570 // if( __cfaasm_in( ip, debug ) ) { ready = false; goto EXIT; }; 558 571 if( !__cfaabi_tls.preemption_state.enabled) { ready = false; goto EXIT; }; 559 572 if( __cfaabi_tls.preemption_state.in_progress ) { ready = false; goto EXIT; }; … … 661 674 662 675 // Check if it is safe to preempt here 663 if( !preemption_ready( ip ) ) { return; } 676 if( !preemption_ready( ip ) ) { 677 #if !defined(__CFA_NO_STATISTICS__) 678 __cfaabi_tls.this_stats->ready.threads.preempt.rllfwd++; 679 #endif 680 return; 681 } 664 682 665 683 __cfaabi_dbg_print_buffer_decl( " KERNEL: preempting core %p (%p @ %p).\n", __cfaabi_tls.this_processor, __cfaabi_tls.this_thread, (void *)(cxt->uc_mcontext.CFA_REG_IP) ); … … 680 698 681 699 // Preemption can occur here 700 701 #if !defined(__CFA_NO_STATISTICS__) 702 __cfaabi_tls.this_stats->ready.threads.preempt.yield++; 703 #endif 682 704 683 705 force_yield( __ALARM_PREEMPTION ); // Do the actual __cfactx_switch
Note:
See TracChangeset
for help on using the changeset viewer.