Skip to content

Conversation

@peter-mitsis
Copy link
Contributor

Instead of performing a linear search to determine if a given thread is running on another CPU, or if it is marked as being preempted by a metaIRQ on any CPU do this in O(1) time.

On SMP systems, Zephyr already tracks the CPU on which a thread executes (or lasted executed). This information is leveraged to do the search in O(1) time.

Instead of performing a linear search to determine if a given
thread is running on another CPU, or if it is marked as being
preempted by a metaIRQ on any CPU do this in O(1) time.

On SMP systems, Zephyr already tracks the CPU on which a thread
executes (or lasted executed). This information is leveraged to
do the search in O(1) time.

Signed-off-by: Peter Mitsis <[email protected]>
@sonarqubecloud
Copy link


#ifdef CONFIG_SMP
thread_base->is_idle = 0;
thread_base->cpu = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It means the run on cpu 0 last time, should we use a magic number to indicate edge case for thread does not run before?

Additional, there is comment from _thread_base, the semantic is changed now.

/* CPU index on which thread was last run */
uint8_t cpu;

By the way, I think it is used to cpu affinity before but I am not sure we have this feature or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants