[PATCH 5/5] score: Remove unused default scheduler ops

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 17 07:02:59 UTC 2021


If SMP support is enabled and the system has exactly one processor, then
it may use an uniprocessor scheduler.  The ask for help, reconsider help
request, and withdraw node operations can be NULL in this case, since
they are only used if a thread has at least one helping scheduler node.
At least two schedulers are required to get a helping node and each
scheduler involved must own at least one processor.  This is not
possible on a system with exactly one processor.
---
 cpukit/include/rtems/score/scheduler.h        | 59 ++++--------------
 cpukit/score/src/schedulerdefaultaskforhelp.c | 61 -------------------
 spec/build/cpukit/objsmp.yml                  |  1 -
 3 files changed, 13 insertions(+), 108 deletions(-)
 delete mode 100644 cpukit/score/src/schedulerdefaultaskforhelp.c

diff --git a/cpukit/include/rtems/score/scheduler.h b/cpukit/include/rtems/score/scheduler.h
index 36fc1fd39c..df9477fbeb 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -400,49 +400,6 @@ Priority_Control _Scheduler_default_Unmap_priority(
 );
 
 #if defined(RTEMS_SMP)
-  /**
-   * @brief Does nothing.
-   *
-   * @param scheduler This parameter is unused.
-   * @param the_thread This parameter is unused.
-   * @param node This parameter is unused.
-   *
-   * @return Always returns false.
-   */
-  bool _Scheduler_default_Ask_for_help(
-    const Scheduler_Control *scheduler,
-    Thread_Control          *the_thread,
-    Scheduler_Node          *node
-  );
-
-  /**
-   * @brief Does nothing.
-   *
-   * @param scheduler This parameter is unused.
-   * @param the_thread This parameter is unused.
-   * @param node This parameter is unused.
-   */
-  void _Scheduler_default_Reconsider_help_request(
-    const Scheduler_Control *scheduler,
-    Thread_Control          *the_thread,
-    Scheduler_Node          *node
-  );
-
-  /**
-   * @brief Does nothing.
-   *
-   * @param scheduler This parameter is unused.
-   * @param the_thread This parameter is unused..
-   * @param node This parameter is unused.
-   * @param next_state This parameter is unused.
-   */
-  void _Scheduler_default_Withdraw_node(
-    const Scheduler_Control *scheduler,
-    Thread_Control          *the_thread,
-    Scheduler_Node          *node,
-    Thread_Scheduler_state   next_state
-  );
-
   /**
    * @brief Does nothing.
    *
@@ -489,12 +446,22 @@ Priority_Control _Scheduler_default_Unmap_priority(
  * schedulers shall implement the operations properly.
  *
  * If SMP support is disabled, the define evaluates to nothing.
+ *
+ * If SMP support is enabled and the system has exactly one processor, then it
+ * may use an uniprocessor scheduler.  The ask for help, reconsider help
+ * request, and withdraw node operations are NULL, since they are only used if
+ * a thread has at least one helping scheduler node.  At least two schedulers
+ * are required to get a helping node and each scheduler involved must own at
+ * least one processor.  This is not possible on a system with exactly one
+ * processor.  The processor add operation is NULL, since there is no other
+ * processor to add.  The processor remove operation is NULL, since the one and
+ * only processor cannot be removed.
  */
 #if defined(RTEMS_SMP)
   #define SCHEDULER_DEFAULT_SMP_OPERATIONS \
-    _Scheduler_default_Ask_for_help, \
-    _Scheduler_default_Reconsider_help_request, \
-    _Scheduler_default_Withdraw_node, \
+    NULL, \
+    NULL, \
+    NULL, \
     _Scheduler_default_Pin_or_unpin_do_nothing, \
     _Scheduler_default_Pin_or_unpin_do_nothing, \
     NULL, \
diff --git a/cpukit/score/src/schedulerdefaultaskforhelp.c b/cpukit/score/src/schedulerdefaultaskforhelp.c
deleted file mode 100644
index 17c222eafb..0000000000
--- a/cpukit/score/src/schedulerdefaultaskforhelp.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * @file
- *
- * @ingroup RTEMSScoreScheduler
- *
- * @brief This source file contains the implementation of
- *   _Scheduler_default_Ask_for_help(),
- *   _Scheduler_default_Reconsider_help_request(), and
- *   _Scheduler_default_Withdraw_node().
- */
-
-/*
- * Copyright (c) 2014, 2016 embedded brains GmbH
- *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/scheduler.h>
-
-bool _Scheduler_default_Ask_for_help(
-  const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread,
-  Scheduler_Node          *node
-)
-{
-  (void) scheduler;
-  (void) the_thread;
-  (void) node;
-
-  return false;
-}
-
-void _Scheduler_default_Reconsider_help_request(
-  const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread,
-  Scheduler_Node          *node
-)
-{
-  (void) scheduler;
-  (void) the_thread;
-  (void) node;
-}
-
-void _Scheduler_default_Withdraw_node(
-  const Scheduler_Control *scheduler,
-  Thread_Control          *the_thread,
-  Scheduler_Node          *node,
-  Thread_Scheduler_state   next_state
-)
-{
-  (void) scheduler;
-  (void) the_thread;
-  (void) node;
-  (void) next_state;
-}
diff --git a/spec/build/cpukit/objsmp.yml b/spec/build/cpukit/objsmp.yml
index ef097a86ed..bb9dfc71b5 100644
--- a/spec/build/cpukit/objsmp.yml
+++ b/spec/build/cpukit/objsmp.yml
@@ -13,7 +13,6 @@ source:
 - cpukit/score/src/percpujobs.c
 - cpukit/score/src/percpustatewait.c
 - cpukit/score/src/profilingsmplock.c
-- cpukit/score/src/schedulerdefaultaskforhelp.c
 - cpukit/score/src/schedulerdefaultpinunpin.c
 - cpukit/score/src/schedulerdefaultpinunpindonothing.c
 - cpukit/score/src/schedulerdefaultsetaffinity.c
-- 
2.31.1



More information about the devel mailing list