<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">+ * @retval SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK The node shall be blocked. This<br>+ * action is returned, if the owner thread is already scheduled by another<br>+ * scheduler.</blockquote><div>When would this happen? When a thread is getting help from a different processor that is using a different scheduler, right?</div><div>A thread has a node for it in each scheduler, right? ( I saw this in threadinitialize.c)</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> If a node requires an executing thread<br>+ * due to some locking protocol and the owner thread is already scheduled by<br>+ * another scheduler, then an idle thread shall be attached to the node.</blockquote><div>What purpose does this serve? </div><div><br></div><div> </div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 5, 2020 at 7:02 PM Richi Dubey <<a href="mailto:richidubey@gmail.com">richidubey@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks for the explanation. I do not understand it right now, but I'm hoping it'd make sense some time in the future :p</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Aug 5, 2020 at 12:50 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">---<br>
cpukit/include/rtems/score/schedulerimpl.h | 44 +++++++++++++++++-----<br>
1 file changed, 34 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/cpukit/include/rtems/score/schedulerimpl.h b/cpukit/include/rtems/score/schedulerimpl.h<br>
index e7fbb8b166..8f5e1ba7b8 100644<br>
--- a/cpukit/include/rtems/score/schedulerimpl.h<br>
+++ b/cpukit/include/rtems/score/schedulerimpl.h<br>
@@ -929,6 +929,10 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_Use_idle_thread(<br>
return idle;<br>
}<br>
<br>
+/**<br>
+ * @brief This enumeration defines what a scheduler should do with a node which<br>
+ * could be scheduled.<br>
+ */<br>
typedef enum {<br>
SCHEDULER_TRY_TO_SCHEDULE_DO_SCHEDULE,<br>
SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE,<br>
@@ -936,21 +940,41 @@ typedef enum {<br>
} Scheduler_Try_to_schedule_action;<br>
<br>
/**<br>
- * @brief Tries to schedule this scheduler node.<br>
- *<br>
- * @param context The scheduler instance context.<br>
- * @param[in, out] node The node which wants to get scheduled.<br>
- * @param idle A potential idle thread used by a potential victim node.<br>
- * @param get_idle_thread Function to get an idle thread.<br>
- *<br>
- * @retval true This node can be scheduled.<br>
- * @retval false This node cannot be scheduled.<br>
+ * @brief Tries to schedule the scheduler node.<br>
+ *<br>
+ * When a scheduler needs to schedule a node, it shall use this function to<br>
+ * determine what it shall do with the node. The node replaces a victim node if<br>
+ * it can be scheduled.<br>
+ *<br>
+ * This function uses the state of the node and the scheduler state of the owner<br>
+ * thread to determine what shall be done. Each scheduler maintains its nodes<br>
+ * independent of other schedulers. This function ensures that a thread is<br>
+ * scheduled by at most one scheduler. If a node requires an executing thread<br>
+ * due to some locking protocol and the owner thread is already scheduled by<br>
+ * another scheduler, then an idle thread shall be attached to the node.<br>
+ *<br>
+ * @param[in, out] context is the scheduler instance context.<br>
+ * @param[in, out] node is the node which could be scheduled.<br>
+ * @param idle is an idle thread used by the victim node or NULL.<br>
+ * @param get_idle_thread points to a function to get an idle thread.<br>
+ *<br>
+ * @retval SCHEDULER_TRY_TO_SCHEDULE_DO_SCHEDULE The node shall be scheduled.<br>
+ *<br>
+ * @retval SCHEDULER_TRY_TO_SCHEDULE_DO_IDLE_EXCHANGE The node shall be<br>
+ * scheduled and the provided idle thread shall be attached to the node. This<br>
+ * action is returned, if the node cannot use the owner thread and shall use<br>
+ * an idle thread instead. In this case, the idle thread is provided by the<br>
+ * victim node.<br>
+ *<br>
+ * @retval SCHEDULER_TRY_TO_SCHEDULE_DO_BLOCK The node shall be blocked. This<br>
+ * action is returned, if the owner thread is already scheduled by another<br>
+ * scheduler.<br>
*/<br>
RTEMS_INLINE_ROUTINE Scheduler_Try_to_schedule_action<br>
_Scheduler_Try_to_schedule_node(<br>
Scheduler_Context *context,<br>
Scheduler_Node *node,<br>
- Thread_Control *idle,<br>
+ const Thread_Control *idle,<br>
Scheduler_Get_idle_thread get_idle_thread<br>
)<br>
{<br>
-- <br>
2.26.2<br>
<br>
_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>
</blockquote></div>