| 212 | } |
| 213 | |
| 214 | void __noinline |
| 215 | critical_exit_preempt(void) |
| 216 | { |
| 217 | struct thread *td; |
| 218 | int flags; |
| 219 | |
| 220 | /* |
| 221 | * If td_critnest is 0, it is possible that we are going to get |
| 222 | * preempted again before reaching the code below. This happens |
| 223 | * rarely and is harmless. However, this means td_owepreempt may |
| 224 | * now be unset. |
| 225 | */ |
| 226 | td = curthread; |
| 227 | if (td->td_critnest != 0) |
| 228 | return; |
| 229 | if (kdb_active) |
| 230 | return; |
| 231 | |
| 232 | /* |
| 233 | * Microoptimization: we committed to switch, |
| 234 | * disable preemption in interrupt handlers |
| 235 | * while spinning for the thread lock. |
| 236 | */ |
| 237 | td->td_critnest = 1; |
| 238 | thread_lock(td); |
| 239 | td->td_critnest--; |
| 240 | flags = SW_INVOL | SW_PREEMPT; |
| 241 | if (TD_IS_IDLETHREAD(td)) |
| 242 | flags |= SWT_IDLE; |
| 243 | else |
| 244 | flags |= SWT_OWEPREEMPT; |
| 245 | mi_switch(flags); |
| 246 | } |
| 247 | |
| 248 | void |
| 249 | critical_exit_KBI(void) |
no test coverage detected