Module: xenomai-head
Branch: master
Commit: ffead3bc0e01722f47c85388a4b10bebe8e23d29
URL:    
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=ffead3bc0e01722f47c85388a4b10bebe8e23d29

Author: Philippe Gerum <r...@xenomai.org>
Date:   Mon Aug 16 17:21:15 2010 +0200

nucleus: demote RPI boost upon linux-originated signal

This patch clears the RPI boost for any relaxed thread which is
getting a signal while running, so that it won't keep a boosted
priority to process asynchronous linux-originated events, such as
termination signals.

Rationale: RPI is mainly for preventing priority inversion during
normal operations in secondary mode, handling signals should not apply
there, since this would also boost low-priority cleanup work, which is
unwanted. The thread may get RPI-boosted again the next time it
resumes for suspension, linux-wise (if ever it does).

---

 ksrc/nucleus/shadow.c |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c
index b2d4326..3d14784 100644
--- a/ksrc/nucleus/shadow.c
+++ b/ksrc/nucleus/shadow.c
@@ -2649,7 +2649,7 @@ static inline void do_sigwake_event(struct task_struct *p)
        struct xnthread *thread = xnshadow_thread(p);
        spl_t s;
 
-       if (!thread)
+       if (thread == NULL)
                return;
 
        xnlock_get_irqsave(&nklock, s);
@@ -2668,8 +2668,25 @@ static inline void do_sigwake_event(struct task_struct 
*p)
                }
        }
 
-       if (xnthread_test_state(thread, XNRELAX))
-               goto unlock_and_exit;
+       /*
+        * If a relaxed thread is getting a signal while running, we
+        * force it out of RPI, so that it won't keep a boosted
+        * priority to process asynchronous linux-originated events,
+        * such as termination signals. RPI is mainly for preventing
+        * priority inversion during normal operations in secondary
+        * mode, handling signals should not apply there, since this
+        * would also boost low-priority cleanup work, which is
+        * unwanted. The thread may get RPI-boosted again the next
+        * time it resumes for suspension, linux-wise (if ever it
+        * does).
+        */
+       if (xnthread_test_state(thread, XNRELAX)) {
+               xnlock_put_irqrestore(&nklock, s);
+               rpi_pop(thread);
+               xnpod_schedule();
+               return;
+       }
+
        /*
         * If we are kicking a shadow thread in primary mode, make
         * sure Linux won't schedule in its mate under our feet as a


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to