[rtems commit] score: Delete unused _Scheduler_Priority_compare()
Sebastian Huber
sebh at rtems.org
Wed Jun 22 12:47:31 UTC 2016
Module: rtems
Branch: master
Commit: b8f76fa28e1e7258fbf9b15894fbf1be5b1fbe15
Changeset: http://git.rtems.org/rtems/commit/?id=b8f76fa28e1e7258fbf9b15894fbf1be5b1fbe15
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Thu Jun 9 16:55:50 2016 +0200
score: Delete unused _Scheduler_Priority_compare()
By convention, thread priorities must be integers in RTEMS. Smaller
values represent more important threads.
---
cpukit/score/Makefile.am | 2 -
cpukit/score/include/rtems/score/scheduler.h | 6 ---
cpukit/score/include/rtems/score/schedulercbs.h | 1 -
cpukit/score/include/rtems/score/scheduleredf.h | 14 ------
.../score/include/rtems/score/scheduleredfimpl.h | 5 +++
cpukit/score/include/rtems/score/schedulerimpl.h | 51 ----------------------
.../score/include/rtems/score/schedulerpriority.h | 13 ------
.../rtems/score/schedulerpriorityaffinitysmp.h | 1 -
.../include/rtems/score/schedulerpriorityimpl.h | 17 --------
.../include/rtems/score/schedulerprioritysmp.h | 1 -
cpukit/score/include/rtems/score/schedulersimple.h | 1 -
.../score/include/rtems/score/schedulersimplesmp.h | 1 -
.../score/include/rtems/score/schedulerstrongapa.h | 1 -
cpukit/score/src/schedulercbsunblock.c | 9 ++--
cpukit/score/src/scheduleredf.c | 22 ++++++++++
cpukit/score/src/scheduleredfprioritycompare.c | 47 --------------------
cpukit/score/src/scheduleredfunblock.c | 10 +++--
.../score/src/schedulerpriorityprioritycompare.c | 29 ------------
18 files changed, 37 insertions(+), 194 deletions(-)
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 537cf60..7166d72 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -239,7 +239,6 @@ libscore_a_SOURCES += src/schedulerdefaultupdate.c
libscore_a_SOURCES += src/schedulerpriority.c \
src/schedulerpriorityblock.c \
src/schedulerprioritychangepriority.c \
- src/schedulerpriorityprioritycompare.c \
src/schedulerpriorityschedule.c \
src/schedulerpriorityunblock.c \
src/schedulerpriorityupdate.c \
@@ -258,7 +257,6 @@ libscore_a_SOURCES += src/scheduleredf.c \
src/scheduleredfnodeinit.c \
src/scheduleredfblock.c \
src/scheduleredfchangepriority.c \
- src/scheduleredfprioritycompare.c \
src/scheduleredfreleasejob.c \
src/scheduleredfschedule.c \
src/scheduleredfunblock.c \
diff --git a/cpukit/score/include/rtems/score/scheduler.h b/cpukit/score/include/rtems/score/scheduler.h
index 1e6236f..2e9aba5 100644
--- a/cpukit/score/include/rtems/score/scheduler.h
+++ b/cpukit/score/include/rtems/score/scheduler.h
@@ -129,12 +129,6 @@ typedef struct {
Priority_Control
);
- /** @see _Scheduler_Priority_compare() */
- int ( *priority_compare )(
- Priority_Control,
- Priority_Control
- );
-
/** @see _Scheduler_Release_job() */
void ( *release_job ) (
const Scheduler_Control *,
diff --git a/cpukit/score/include/rtems/score/schedulercbs.h b/cpukit/score/include/rtems/score/schedulercbs.h
index e390532..397488f 100644
--- a/cpukit/score/include/rtems/score/schedulercbs.h
+++ b/cpukit/score/include/rtems/score/schedulercbs.h
@@ -59,7 +59,6 @@ extern "C" {
_Scheduler_CBS_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_EDF_Update_priority, /* update priority entry point */ \
- _Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_CBS_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
diff --git a/cpukit/score/include/rtems/score/scheduleredf.h b/cpukit/score/include/rtems/score/scheduleredf.h
index 137ea3a..7d513ca 100644
--- a/cpukit/score/include/rtems/score/scheduleredf.h
+++ b/cpukit/score/include/rtems/score/scheduleredf.h
@@ -52,7 +52,6 @@ extern "C" {
_Scheduler_EDF_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_EDF_Update_priority, /* update priority entry point */ \
- _Scheduler_EDF_Priority_compare, /* compares two priorities */ \
_Scheduler_EDF_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
@@ -226,19 +225,6 @@ Scheduler_Void_or_thread _Scheduler_EDF_Yield(
);
/**
- * @brief Explicitly compare absolute dedlines (priorities) of threads.
- *
- * This routine explicitly compares absolute dedlines (priorities) of threads.
- * In case of EDF scheduling time overflow is taken into account.
- *
- * @retval >0 for p1 > p2; 0 for p1 == p2; <0 for p1 < p2.
- */
-int _Scheduler_EDF_Priority_compare (
- Priority_Control p1,
- Priority_Control p2
-);
-
-/**
* @brief Called when a new job of task is released.
*
* This routine is called when a new job of task is released.
diff --git a/cpukit/score/include/rtems/score/scheduleredfimpl.h b/cpukit/score/include/rtems/score/scheduleredfimpl.h
index 4feea71..e831caf 100644
--- a/cpukit/score/include/rtems/score/scheduleredfimpl.h
+++ b/cpukit/score/include/rtems/score/scheduleredfimpl.h
@@ -44,6 +44,11 @@ RTEMS_INLINE_ROUTINE Scheduler_EDF_Node *_Scheduler_EDF_Thread_get_node(
return (Scheduler_EDF_Node *) _Scheduler_Thread_get_node( the_thread );
}
+int _Scheduler_EDF_Priority_compare (
+ Priority_Control p1,
+ Priority_Control p2
+);
+
RBTree_Compare_result _Scheduler_EDF_Compare(
const RBTree_Node* n1,
const RBTree_Node* n2
diff --git a/cpukit/score/include/rtems/score/schedulerimpl.h b/cpukit/score/include/rtems/score/schedulerimpl.h
index bfc6df3..50061fb 100644
--- a/cpukit/score/include/rtems/score/schedulerimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerimpl.h
@@ -482,31 +482,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Update_priority(
}
/**
- * @brief Compares two priority values.
- *
- * @param[in] scheduler The scheduler instance.
- * @param[in] p1 The first priority value.
- * @param[in] p2 The second priority value.
- *
- * @retval negative The value @a p1 encodes a lower priority than @a p2 in the
- * intuitive sense of priority.
- * @retval 0 The priorities @a p1 and @a p2 are equal.
- * @retval positive The value @a p1 encodes a higher priority than @a p2 in the
- * intuitive sense of priority.
- *
- * @see _Scheduler_Is_priority_lower_than() and
- * _Scheduler_Is_priority_higher_than().
- */
-RTEMS_INLINE_ROUTINE int _Scheduler_Priority_compare(
- const Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
-)
-{
- return ( *scheduler->Operations.priority_compare )( p1, p2 );
-}
-
-/**
* @brief Releases a job of a thread with respect to the scheduler.
*
* @param[in] the_thread The thread.
@@ -746,32 +721,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_Generic_block(
}
}
-/**
- * @brief Returns true if @a p1 encodes a lower priority than @a p2 in the
- * intuitive sense of priority.
- */
-RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_lower_than(
- const Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
-)
-{
- return _Scheduler_Priority_compare( scheduler, p1, p2 ) < 0;
-}
-
-/**
- * @brief Returns true if @a p1 encodes a higher priority than @a p2 in the
- * intuitive sense of priority.
- */
-RTEMS_INLINE_ROUTINE bool _Scheduler_Is_priority_higher_than(
- const Scheduler_Control *scheduler,
- Priority_Control p1,
- Priority_Control p2
-)
-{
- return _Scheduler_Priority_compare( scheduler, p1, p2 ) > 0;
-}
-
RTEMS_INLINE_ROUTINE uint32_t _Scheduler_Get_processor_count(
const Scheduler_Control *scheduler
)
diff --git a/cpukit/score/include/rtems/score/schedulerpriority.h b/cpukit/score/include/rtems/score/schedulerpriority.h
index 5859af1..0759941 100644
--- a/cpukit/score/include/rtems/score/schedulerpriority.h
+++ b/cpukit/score/include/rtems/score/schedulerpriority.h
@@ -49,7 +49,6 @@ extern "C" {
_Scheduler_default_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_priority_Update_priority, /* update priority entry point */ \
- _Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
@@ -189,18 +188,6 @@ Scheduler_Void_or_thread _Scheduler_priority_Yield(
Thread_Control *the_thread
);
-/**
- * @brief Compare two priorities.
- *
- * This routine compares two priorities.
- *
- * @retval >0 for p1 > p2; 0 for p1 == p2; <0 for p1 < p2.
- */
-int _Scheduler_priority_Priority_compare(
- Priority_Control p1,
- Priority_Control p2
-);
-
/**@}*/
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
index dd0085a6..e2d6f3b 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityaffinitysmp.h
@@ -59,7 +59,6 @@ extern "C" {
_Scheduler_priority_affinity_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
_Scheduler_priority_SMP_Update_priority, \
- _Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
_Scheduler_SMP_Start_idle, \
diff --git a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
index a18840f..d709818 100644
--- a/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
+++ b/cpukit/score/include/rtems/score/schedulerpriorityimpl.h
@@ -219,23 +219,6 @@ RTEMS_INLINE_ROUTINE void _Scheduler_priority_Ready_queue_update(
);
}
-/**
- * @brief Priority comparison.
- *
- * This routine implements priority comparison for priority-based
- * scheduling.
- *
- * @return >0 for higher priority, 0 for equal and <0 for lower priority.
- */
-RTEMS_INLINE_ROUTINE int _Scheduler_priority_Priority_compare_body(
- Priority_Control p1,
- Priority_Control p2
-)
-{
- /* High priority in priority scheduler is represented by low numbers. */
- return ( p2 - p1 );
-}
-
/** @} */
#ifdef __cplusplus
diff --git a/cpukit/score/include/rtems/score/schedulerprioritysmp.h b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
index d8ce7dc..d550c78 100644
--- a/cpukit/score/include/rtems/score/schedulerprioritysmp.h
+++ b/cpukit/score/include/rtems/score/schedulerprioritysmp.h
@@ -88,7 +88,6 @@ typedef struct {
_Scheduler_priority_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
_Scheduler_priority_SMP_Update_priority, \
- _Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
_Scheduler_SMP_Start_idle \
diff --git a/cpukit/score/include/rtems/score/schedulersimple.h b/cpukit/score/include/rtems/score/schedulersimple.h
index a546ed6..9e40c4a 100644
--- a/cpukit/score/include/rtems/score/schedulersimple.h
+++ b/cpukit/score/include/rtems/score/schedulersimple.h
@@ -49,7 +49,6 @@ extern "C" {
_Scheduler_default_Node_initialize, /* node initialize entry point */ \
_Scheduler_default_Node_destroy, /* node destroy entry point */ \
_Scheduler_default_Update_priority, /* update priority entry point */ \
- _Scheduler_priority_Priority_compare, /* compares two priorities */ \
_Scheduler_default_Release_job, /* new period of task */ \
_Scheduler_default_Tick, /* tick entry point */ \
_Scheduler_default_Start_idle /* start idle entry point */ \
diff --git a/cpukit/score/include/rtems/score/schedulersimplesmp.h b/cpukit/score/include/rtems/score/schedulersimplesmp.h
index 342a574..b943353 100644
--- a/cpukit/score/include/rtems/score/schedulersimplesmp.h
+++ b/cpukit/score/include/rtems/score/schedulersimplesmp.h
@@ -71,7 +71,6 @@ typedef struct {
_Scheduler_simple_SMP_Node_initialize, \
_Scheduler_default_Node_destroy, \
_Scheduler_simple_SMP_Update_priority, \
- _Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
_Scheduler_SMP_Start_idle \
diff --git a/cpukit/score/include/rtems/score/schedulerstrongapa.h b/cpukit/score/include/rtems/score/schedulerstrongapa.h
index 5222cd0..4f95aac 100644
--- a/cpukit/score/include/rtems/score/schedulerstrongapa.h
+++ b/cpukit/score/include/rtems/score/schedulerstrongapa.h
@@ -88,7 +88,6 @@ typedef struct {
_Scheduler_strong_APA_Node_initialize, \
_Scheduler_default_Node_destroy, \
_Scheduler_strong_APA_Update_priority, \
- _Scheduler_priority_Priority_compare, \
_Scheduler_default_Release_job, \
_Scheduler_default_Tick, \
_Scheduler_SMP_Start_idle \
diff --git a/cpukit/score/src/schedulercbsunblock.c b/cpukit/score/src/schedulercbsunblock.c
index 7898588..05e155a 100644
--- a/cpukit/score/src/schedulercbsunblock.c
+++ b/cpukit/score/src/schedulercbsunblock.c
@@ -79,11 +79,10 @@ Scheduler_Void_or_thread _Scheduler_CBS_Unblock(
* a pseudo-ISR system task, we need to do a context switch.
*/
if (
- _Scheduler_Is_priority_higher_than(
- scheduler,
- the_thread->current_priority,
- _Thread_Heir->current_priority
- )
+ _Scheduler_EDF_Priority_compare(
+ the_thread->current_priority,
+ _Thread_Heir->current_priority
+ ) == 1
) {
_Scheduler_Update_heir(
the_thread,
diff --git a/cpukit/score/src/scheduleredf.c b/cpukit/score/src/scheduleredf.c
index 00b6181..3726128 100644
--- a/cpukit/score/src/scheduleredf.c
+++ b/cpukit/score/src/scheduleredf.c
@@ -20,6 +20,28 @@
#include <rtems/score/scheduleredfimpl.h>
+int _Scheduler_EDF_Priority_compare (
+ Priority_Control p1,
+ Priority_Control p2
+)
+{
+ Watchdog_Interval time = _Watchdog_Ticks_since_boot;
+
+ /*
+ * Reorder priorities to separate deadline driven and background tasks.
+ *
+ * The background tasks have p1 or p2 > SCHEDULER_EDF_PRIO_MSB.
+ * The deadline driven tasks need to have subtracted current time in order
+ * to see which deadline is closer wrt. current time.
+ */
+ if (!(p1 & SCHEDULER_EDF_PRIO_MSB))
+ p1 = (p1 - time) & ~SCHEDULER_EDF_PRIO_MSB;
+ if (!(p2 & SCHEDULER_EDF_PRIO_MSB))
+ p2 = (p2 - time) & ~SCHEDULER_EDF_PRIO_MSB;
+
+ return ((p1<p2) - (p1>p2));
+}
+
RBTree_Compare_result _Scheduler_EDF_Compare(
const RBTree_Node* n1,
const RBTree_Node* n2
diff --git a/cpukit/score/src/scheduleredfprioritycompare.c b/cpukit/score/src/scheduleredfprioritycompare.c
deleted file mode 100644
index 0fbfaa6..0000000
--- a/cpukit/score/src/scheduleredfprioritycompare.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * @file
- *
- * @brief Compares Priorities of Threads
- *
- * @ingroup ScoreScheduler
- */
-
-/*
- * Copyright (C) 2011 Petr Benes.
- * Copyright (C) 2011 On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/system.h>
-#include <rtems/config.h>
-#include <rtems/score/scheduleredf.h>
-#include <rtems/score/watchdogimpl.h>
-
-int _Scheduler_EDF_Priority_compare (
- Priority_Control p1,
- Priority_Control p2
-)
-{
- Watchdog_Interval time = _Watchdog_Ticks_since_boot;
-
- /*
- * Reorder priorities to separate deadline driven and background tasks.
- *
- * The background tasks have p1 or p2 > SCHEDULER_EDF_PRIO_MSB.
- * The deadline driven tasks need to have subtracted current time in order
- * to see which deadline is closer wrt. current time.
- */
- if (!(p1 & SCHEDULER_EDF_PRIO_MSB))
- p1 = (p1 - time) & ~SCHEDULER_EDF_PRIO_MSB;
- if (!(p2 & SCHEDULER_EDF_PRIO_MSB))
- p2 = (p2 - time) & ~SCHEDULER_EDF_PRIO_MSB;
-
- return ((p1<p2) - (p1>p2));
-}
diff --git a/cpukit/score/src/scheduleredfunblock.c b/cpukit/score/src/scheduleredfunblock.c
index 9775342..43d9753 100644
--- a/cpukit/score/src/scheduleredfunblock.c
+++ b/cpukit/score/src/scheduleredfunblock.c
@@ -42,10 +42,12 @@ Scheduler_Void_or_thread _Scheduler_EDF_Unblock(
* Even if the thread isn't preemptible, if the new heir is
* a pseudo-ISR system task, we need to do a context switch.
*/
- if ( _Scheduler_Is_priority_lower_than(
- scheduler,
- _Thread_Heir->current_priority,
- the_thread->current_priority )) {
+ if (
+ _Scheduler_EDF_Priority_compare(
+ the_thread->current_priority,
+ _Thread_Heir->current_priority
+ ) == 1
+ ) {
_Scheduler_Update_heir(
the_thread,
the_thread->current_priority == PRIORITY_PSEUDO_ISR
diff --git a/cpukit/score/src/schedulerpriorityprioritycompare.c b/cpukit/score/src/schedulerpriorityprioritycompare.c
deleted file mode 100644
index 6879d01..0000000
--- a/cpukit/score/src/schedulerpriorityprioritycompare.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * @file
- *
- * @brief Scheduler Priority Compare Two Priorities
- * @ingroup ScoreScheduler
- */
-
-/*
- * COPYRIGHT (c) 2011.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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.
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems/score/schedulerpriorityimpl.h>
-
-int _Scheduler_priority_Priority_compare(
- Priority_Control p1,
- Priority_Control p2
-)
-{
- return _Scheduler_priority_Priority_compare_body( p1, p2 );
-}
More information about the vc
mailing list