Changeset 625 for trunk/kernel/kern/scheduler.c
- Timestamp:
- Apr 10, 2019, 10:09:39 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/scheduler.c
r624 r625 180 180 sched = &core->scheduler; 181 181 182 /////////////// scan user threads to handle both ACK and DELETE requests182 ////////////////// scan user threads to handle both ACK and DELETE requests 183 183 root = &sched->u_root; 184 184 iter = root->next; … … 240 240 busylock_release( &sched->lock ); 241 241 242 // check th_nr value 243 assert( (process->th_nr > 0) , "process th_nr cannot be 0\n" ); 244 245 // remove thread from process th_tbl[] 246 process->th_tbl[ltid] = NULL; 247 count = hal_atomic_add( &process->th_nr , - 1 ); 248 249 // release memory allocated for thread descriptor 250 thread_destroy( thread ); 242 // release memory allocated for thread 243 count = thread_destroy( thread ); 251 244 252 245 hal_fence(); … … 255 248 uint32_t cycle = (uint32_t)hal_get_cycles(); 256 249 if( DEBUG_SCHED_HANDLE_SIGNALS < cycle ) 257 printk("\n[%s] thread[%x,%x] on core[%x,%d] deleted / cycle %d\n",258 __FUNCTION__ , process->pid , thread->trdid , local_cxy , thread->core->lid, cycle );250 printk("\n[%s] thread[%x,%x] on core[%x,%d] deleted / %d threads / cycle %d\n", 251 __FUNCTION__, process->pid, thread->trdid, local_cxy, thread->core->lid, count, cycle ); 259 252 #endif 260 253 // destroy process descriptor if last thread … … 274 267 } // end user threads 275 268 276 ////// scan kernel threads for DELETE only269 ///////////// scan kernel threads for DELETE only 277 270 root = &sched->k_root; 278 271 iter = root->next; … … 290 283 291 284 // check process descriptor is local kernel process 292 assert( ( thread->process == &process_zero ) , "illegal process descriptor \n");285 assert( ( thread->process == &process_zero ) , "illegal process descriptor"); 293 286 294 287 // get thread ltid … … 325 318 326 319 // check th_nr value 327 assert( (process_zero.th_nr > 0) , "kernel process th_nr cannot be 0 \n" );320 assert( (process_zero.th_nr > 0) , "kernel process th_nr cannot be 0" ); 328 321 329 322 // remove thread from process th_tbl[] … … 477 470 } // end sched_register_thread() 478 471 479 ////////////////////////////////////// 480 void sched_yield( const char * cause )472 ////////////////////////////////////////////////////////////////// 473 void sched_yield( const char * cause __attribute__((__unused__)) ) 481 474 { 482 475 thread_t * next; … … 512 505 // check next thread kernel_stack overflow 513 506 assert( (next->signature == THREAD_SIGNATURE), 514 "kernel stack overflow for thread %x on core[%x,%d] \n", next, local_cxy, lid );507 "kernel stack overflow for thread %x on core[%x,%d]", next, local_cxy, lid ); 515 508 516 509 // check next thread attached to same core as the calling thread 517 510 assert( (next->core == current->core), 518 "next core %x != current core %x \n", next->core, current->core );511 "next core %x != current core %x", next->core, current->core ); 519 512 520 513 // check next thread not blocked when type != IDLE 521 514 assert( ((next->blocked == 0) || (next->type == THREAD_IDLE)) , 522 "next thread %x (%s) is blocked on core[%x,%d] \n",515 "next thread %x (%s) is blocked on core[%x,%d]", 523 516 next->trdid , thread_type_str(next->type) , local_cxy , lid ); 524 517 … … 561 554 #if (DEBUG_SCHED_YIELD & 1) 562 555 // if( sched->trace ) 563 if( uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD )556 if( (uint32_t)hal_get_cycles() > DEBUG_SCHED_YIELD ) 564 557 printk("\n[%s] core[%x,%d] / cause = %s\n" 565 558 " thread %x (%s) (%x,%x) continue / cycle %d\n", … … 584 577 list_entry_t * iter; 585 578 thread_t * thread; 586 587 // check lid588 assert( (lid < LOCAL_CLUSTER->cores_nr),589 "illegal core index %d\n", lid);590 579 591 580 core_t * core = &LOCAL_CLUSTER->core_tbl[lid]; … … 644 633 { 645 634 thread_t * thread; 646 647 // check cxy648 assert( (cluster_is_undefined( cxy ) == false),649 "illegal cluster %x\n", cxy );650 651 assert( (lid < hal_remote_l32( XPTR( cxy , &LOCAL_CLUSTER->cores_nr ) ) ),652 "illegal core index %d\n", lid );653 635 654 636 // get local pointer on target scheduler
Note: See TracChangeset
for help on using the changeset viewer.