Module: xenomai-gch
Branch: for-forge
Commit: e9cd51305f100dbd1c7ca6c4a4cd1ac34eaf5f34

Author: Gilles Chanteperdrix <>
Date:   Fri Oct 16 11:27:39 2015 +0200

cobalt/sched: avoid leaking the reschedule bit

handle_setaffinity_event ends up calling migrate_thread() which sets the
reschedling bit. However, since this happens for a passive migration,
xnsched_run() is not called, and the reschedule bit remains. This causes
remote notifications to not send an IPI, and delay them until the system
calls xnsched_run() for another reason.

Fix this by setting the reschedule bit in xnsched_migrate_passive() only
if the thread blockbits are not set.


 kernel/cobalt/sched.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index 792bb80..13cfd7c 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -481,7 +481,6 @@ static void migrate_thread(struct xnthread *thread, struct 
xnsched *sched)
         * WARNING: the scheduling class may have just changed as a
         * result of calling the per-class migration hook.
-       xnsched_set_resched(thread->sched);
        thread->sched = sched;
@@ -491,6 +490,7 @@ static void migrate_thread(struct xnthread *thread, struct 
xnsched *sched)
 void xnsched_migrate(struct xnthread *thread, struct xnsched *sched)
+       xnsched_set_resched(thread->sched);
        migrate_thread(thread, sched);
@@ -516,6 +516,7 @@ void xnsched_migrate_passive(struct xnthread *thread, 
struct xnsched *sched)
        if (!xnthread_test_state(thread, XNTHREAD_BLOCK_BITS)) {
                xnthread_set_state(thread, XNREADY);
+               xnsched_set_resched(thread->sched);

Xenomai-git mailing list

Reply via email to