kernel: Re-order should_preempt() checks
Re-orders the checks in should_preempt() tests so that the z_is_thread_timeout_active() check is done last. This change has been observed to give a +7% performance boost on the thread_metric benchmark's preemptive scheduling test. Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
This commit is contained in:
parent
73d04a4959
commit
0bf44f2352
1 changed files with 7 additions and 7 deletions
|
@ -204,6 +204,13 @@ static ALWAYS_INLINE bool should_preempt(struct k_thread *thread,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Otherwise we have to be running a preemptible thread or
|
||||||
|
* switching to a metairq
|
||||||
|
*/
|
||||||
|
if (thread_is_preemptible(_current) || thread_is_metairq(thread)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Edge case on ARM where a thread can be pended out of an
|
/* Edge case on ARM where a thread can be pended out of an
|
||||||
* interrupt handler before the "synchronous" swap starts
|
* interrupt handler before the "synchronous" swap starts
|
||||||
* context switching. Platforms with atomic swap can never
|
* context switching. Platforms with atomic swap can never
|
||||||
|
@ -214,13 +221,6 @@ static ALWAYS_INLINE bool should_preempt(struct k_thread *thread,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise we have to be running a preemptible thread or
|
|
||||||
* switching to a metairq
|
|
||||||
*/
|
|
||||||
if (thread_is_preemptible(_current) || thread_is_metairq(thread)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue