From ca1e546e7772838b20d0792155e2c71514d6b5d3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 2 Feb 2017 16:24:05 +0100 Subject: score: Improve scheduler helping protocol Only register ask for help requests in the scheduler unblock and yield operations. The actual ask for help operation is carried out during _Thread_Do_dispatch() on a processor related to the thread. This yields a better separation of scheduler instances. A thread of one scheduler instance should not be forced to carry out too much work for threads on other scheduler instances. Update #2556. --- testsuites/smptests/smpscheduler03/init.c | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) (limited to 'testsuites/smptests') diff --git a/testsuites/smptests/smpscheduler03/init.c b/testsuites/smptests/smpscheduler03/init.c index 51098b6f61..e4aa9855bd 100644 --- a/testsuites/smptests/smpscheduler03/init.c +++ b/testsuites/smptests/smpscheduler03/init.c @@ -315,7 +315,7 @@ static void test_update_priority_op(void) rtems_test_assert(sc == RTEMS_SUCCESSFUL); } -static bool yield_op( +static void yield_op( Thread_Control *thread, Scheduler_SMP_Node *scheduler_node ) @@ -323,13 +323,12 @@ static bool yield_op( const Scheduler_Control *scheduler; ISR_lock_Context state_lock_context; ISR_lock_Context scheduler_lock_context; - bool needs_help; _Thread_State_acquire( thread, &state_lock_context ); scheduler = _Thread_Scheduler_get_home( thread ); _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); - needs_help = (*scheduler->Operations.yield)( + (*scheduler->Operations.yield)( scheduler, thread, &scheduler_node->Base @@ -337,8 +336,6 @@ static bool yield_op( _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); _Thread_State_release( thread, &state_lock_context ); - - return needs_help; } static void test_case_yield_op( @@ -349,7 +346,6 @@ static void test_case_yield_op( Scheduler_SMP_Node_state new_state ) { - bool needs_help; Per_CPU_Control *cpu_self; cpu_self = _Thread_Dispatch_disable(); @@ -393,15 +389,12 @@ static void test_case_yield_op( } rtems_test_assert(executing_node->state == start_state); - needs_help = yield_op(executing, executing_node); + yield_op(executing, executing_node); rtems_test_assert(executing_node->state == new_state); switch (new_state) { case SCHEDULER_SMP_NODE_SCHEDULED: - rtems_test_assert(!needs_help); - break; case SCHEDULER_SMP_NODE_READY: - rtems_test_assert(needs_help); break; default: rtems_test_assert(0); @@ -470,7 +463,7 @@ static void block_op( _Thread_State_release( thread, &state_lock_context ); } -static bool unblock_op( +static void unblock_op( Thread_Control *thread, Scheduler_SMP_Node *scheduler_node ) @@ -478,13 +471,12 @@ static bool unblock_op( const Scheduler_Control *scheduler; ISR_lock_Context state_lock_context; ISR_lock_Context scheduler_lock_context; - bool needs_help; _Thread_State_acquire( thread, &state_lock_context ); scheduler = _Thread_Scheduler_get_home( thread ); _Scheduler_Acquire_critical( scheduler, &scheduler_lock_context ); - needs_help = (*scheduler->Operations.unblock)( + (*scheduler->Operations.unblock)( scheduler, thread, &scheduler_node->Base @@ -492,8 +484,6 @@ static bool unblock_op( _Scheduler_Release_critical( scheduler, &scheduler_lock_context ); _Thread_State_release( thread, &state_lock_context ); - - return needs_help; } static void test_case_unblock_op( @@ -503,7 +493,6 @@ static void test_case_unblock_op( Scheduler_SMP_Node_state new_state ) { - bool needs_help; Per_CPU_Control *cpu_self; cpu_self = _Thread_Dispatch_disable(); @@ -525,15 +514,12 @@ static void test_case_unblock_op( block_op(executing, executing_node); rtems_test_assert(executing_node->state == SCHEDULER_SMP_NODE_BLOCKED); - needs_help = unblock_op(executing, executing_node); + unblock_op(executing, executing_node); rtems_test_assert(executing_node->state == new_state); switch (new_state) { case SCHEDULER_SMP_NODE_SCHEDULED: - rtems_test_assert(!needs_help); - break; case SCHEDULER_SMP_NODE_READY: - rtems_test_assert(needs_help); break; default: rtems_test_assert(0); -- cgit v1.2.3