[rtems commit] score: Remove unused default scheduler ops

Sebastian Huber sebh at rtems.org
Tue Sep 21 08:25:31 UTC 2021


Module:    rtems
Branch:    master
Commit:    cd198a55112799ca770a5d29537d46ee5d983988
Changeset: http://git.rtems.org/rtems/commit/?id=cd198a55112799ca770a5d29537d46ee5d983988

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Fri Sep 17 08:30:57 2021 +0200

score: Remove unused default scheduler ops

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(-)

diff --git a/cpukit/include/rtems/score/scheduler.h b/cpukit/include/rtems/score/scheduler.h
index 36fc1fd..df9477f 100644
--- a/cpukit/include/rtems/score/scheduler.h
+++ b/cpukit/include/rtems/score/scheduler.h
@@ -403,49 +403,6 @@ Priority_Control _Scheduler_default_Unmap_priority(
   /**
    * @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.
-   *
    * This default implementation for the thread pin or unpin operations should
    * be used by uniprocessor schedulers if SMP support is enabled.
    *
@@ -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 17c222e..0000000
--- 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 c1b0611..1a55708 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



More information about the vc mailing list