Changeset 438 for trunk/kernel/kern/scheduler.c
- Timestamp:
- Apr 4, 2018, 2:49:02 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/kern/scheduler.c
r437 r438 125 125 thread = LIST_ELEMENT( current , thread_t , sched_list ); 126 126 127 // analyse kernel thread type 128 switch( thread->type ) 127 // execute RPC thread if non blocked 128 if( (thread->blocked == 0) && 129 (thread->type == THREAD_RPC) ) 129 130 { 130 case THREAD_RPC: // if non blocked and RPC FIFO non-empty 131 if( (thread->blocked == 0) && 132 (local_fifo_is_empty( &LOCAL_CLUSTER->rpc_fifo ) == 0) ) 133 { 134 spinlock_unlock( &sched->lock ); 135 return thread; 136 } 137 break; 138 139 case THREAD_DEV: // if non blocked and waiting queue non empty 140 if( (thread->blocked == 0) && 141 (xlist_is_empty( XPTR( local_cxy , &thread->chdev->wait_root)) == 0) ) 142 { 143 spinlock_unlock( &sched->lock ); 144 return thread; 145 } 146 break; 147 148 default: 149 break; 131 spinlock_unlock( &sched->lock ); 132 return thread; 133 } 134 135 // execute DEV thread if non blocked and waiting queue non empty 136 if( (thread->blocked == 0) && 137 (thread->type == THREAD_DEV) && 138 (xlist_is_empty( XPTR( local_cxy , &thread->chdev->wait_root)) == 0) ) 139 { 140 spinlock_unlock( &sched->lock ); 141 return thread; 150 142 } 151 143 } // end loop on kernel threads … … 174 166 thread = LIST_ELEMENT( current , thread_t , sched_list ); 175 167 176 // return thread if runnable168 // return thread if non blocked 177 169 if( thread->blocked == 0 ) 178 170 { … … 227 219 process = thread->process; 228 220 229 #if CONFIG_DEBUG_SCHED_HANDLE_SIGNALS221 #if DEBUG_SCHED_HANDLE_SIGNALS 230 222 uint32_t cycle = (uint32_t)hal_get_cycles(); 231 if( CONFIG_DEBUG_SCHED_HANDLE_SIGNALS < cycle )223 if( DEBUG_SCHED_HANDLE_SIGNALS < cycle ) 232 224 printk("\n[DBG] %s : thread %x in proces %x must be deleted / cycle %d\n", 233 225 __FUNCTION__ , thread , process->pid , cycle ); … … 250 242 thread_destroy( thread ); 251 243 252 #if CONFIG_DEBUG_SCHED_HANDLE_SIGNALS244 #if DEBUG_SCHED_HANDLE_SIGNALS 253 245 cycle = (uint32_t)hal_get_cycles(); 254 if( CONFIG_DEBUG_SCHED_HANDLE_SIGNALS < cycle )246 if( DEBUG_SCHED_HANDLE_SIGNALS < cycle ) 255 247 printk("\n[DBG] %s : thread %x in process %x has been deleted / cycle %d\n", 256 248 __FUNCTION__ , thread , process->pid , cycle ); … … 262 254 process_destroy( process ); 263 255 264 #if CONFIG_DEBUG_SCHED_HANDLE_SIGNALS256 #if DEBUG_SCHED_HANDLE_SIGNALS 265 257 cycle = (uint32_t)hal_get_cycles(); 266 if( CONFIG_DEBUG_SCHED_HANDLE_SIGNALS < cycle )258 if( DEBUG_SCHED_HANDLE_SIGNALS < cycle ) 267 259 printk("\n[DBG] %s : process %x has been deleted / cycle %d\n", 268 260 __FUNCTION__ , process->pid , cycle ); … … 287 279 scheduler_t * sched = &core->scheduler; 288 280 289 #if ( CONFIG_DEBUG_SCHED_YIELD & 0x1)290 if( CONFIG_DEBUG_SCHED_YIELD < (uint32_t)hal_get_cycles() )281 #if (DEBUG_SCHED_YIELD & 0x1) 282 if( DEBUG_SCHED_YIELD < (uint32_t)hal_get_cycles() ) 291 283 sched_display( core->lid ); 292 284 #endif … … 322 314 { 323 315 324 #if CONFIG_DEBUG_SCHED_YIELD316 #if DEBUG_SCHED_YIELD 325 317 uint32_t cycle = (uint32_t)hal_get_cycles(); 326 if( CONFIG_DEBUG_SCHED_YIELD < cycle )318 if( DEBUG_SCHED_YIELD < cycle ) 327 319 printk("\n[DBG] %s : core[%x,%d] / cause = %s\n" 328 320 " thread %x (%s) (%x,%x) => thread %x (%s) (%x,%x) / cycle %d\n", … … 350 342 { 351 343 352 #if ( CONFIG_DEBUG_SCHED_YIELD & 1)344 #if (DEBUG_SCHED_YIELD & 1) 353 345 uint32_t cycle = (uint32_t)hal_get_cycles(); 354 if( CONFIG_DEBUG_SCHED_YIELD < cycle )346 if( DEBUG_SCHED_YIELD < cycle ) 355 347 printk("\n[DBG] %s : core[%x,%d] / cause = %s\n" 356 348 " thread %x (%s) (%x,%x) continue / cycle %d\n",
Note: See TracChangeset
for help on using the changeset viewer.