Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[kernel][schedule] reduce unnecessary schedule by comparing new ready thread's priority and current #5959

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
distinguish SMP mode
  • Loading branch information
blta committed May 17, 2022
commit 4db5774326ee34a6568abdc2a2ed0650728d585e
4 changes: 4 additions & 0 deletions src/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,9 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
{
rt_base_t level;
rt_err_t result = RT_EOK;
#ifndef RT_USING_SMP
extern rt_uint8_t rt_current_priority;
#endif
/* parameter check */
RT_ASSERT(thread != RT_NULL);
RT_ASSERT(rt_object_get_type((rt_object_t)thread) == RT_Object_Class_Thread);
Expand All @@ -910,6 +912,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
/* insert to schedule ready list */
rt_schedule_insert_thread(thread);

#ifndef RT_USING_SMP
/* compare the priority with rt_current_priority*/
if(thread->current_priority < rt_current_priority)
{
Expand All @@ -919,6 +922,7 @@ rt_err_t rt_thread_resume(rt_thread_t thread)
{
result = RT_EBUSY;
}
#endif

/* enable interrupt */
rt_hw_interrupt_enable(level);
Expand Down