Module: xenomai-jki
Branch: for-upstream
Commit: 202aed29410d400298a46d560fcd6cca518e3665
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=202aed29410d400298a46d560fcd6cca518e3665

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Nov  4 15:10:37 2010 +0100

nucleus: Optimize reschedule signaling for UP

In UP mode, we do not need to fiddle with xnpod::resched at all and can
simply drop this field.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/nucleus/sched.h |    9 ++++++++-
 ksrc/nucleus/pod.c      |    2 ++
 ksrc/nucleus/sched.c    |    2 ++
 3 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/include/nucleus/sched.h b/include/nucleus/sched.h
index 8e47c4f..e251329 100644
--- a/include/nucleus/sched.h
+++ b/include/nucleus/sched.h
@@ -68,7 +68,9 @@ typedef struct xnsched {
        xnflags_t lflags;               /*!< Scheduler specific local flags 
bitmask. */
        int cpu;
        struct xnthread *curr;          /*!< Current thread. */
+#ifdef CONFIG_SMP
        xnarch_cpumask_t resched;       /*!< Mask of CPUs needing rescheduling. 
*/
+#endif
 
        struct xnsched_rt rt;           /*!< Context of built-in real-time 
class. */
 #ifdef CONFIG_XENO_OPT_SCHED_TP
@@ -178,10 +180,12 @@ static inline int xnsched_resched_p(struct xnsched *sched)
 
 /* Set self resched flag for the given scheduler. */
 #define xnsched_set_self_resched(__sched__) do {               \
+  XENO_BUGON(NUCLEUS, __sched__ != xnpod_current_sched());     \
   __setbits((__sched__)->status, XNRESCHED);                   \
 } while (0)
 
-/* Set specific resched flag into the local scheduler mask. */
+/* Set resched flag for the given scheduler. */
+#ifdef CONFIG_SMP
 #define xnsched_set_resched(__sched__) do {                            \
   xnsched_t *current_sched = xnpod_current_sched();                    \
   if (current_sched == (__sched__))                                    \
@@ -192,6 +196,9 @@ static inline int xnsched_resched_p(struct xnsched *sched)
       __setbits(current_sched->status, XNRESCHED);                     \
   }                                                                    \
 } while (0)
+#else /* !CONFIG_SMP */
+#define xnsched_set_resched    xnsched_set_self_resched
+#endif /* !CONFIG_SMP */
 
 void xnsched_zombie_hooks(struct xnthread *thread);
 
diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c
index 476ce28..b57fe31 100644
--- a/ksrc/nucleus/pod.c
+++ b/ksrc/nucleus/pod.c
@@ -2178,6 +2178,8 @@ static inline int __xnpod_test_resched(struct xnsched 
*sched)
                xnarch_send_ipi(sched->resched);
                xnarch_cpus_clear(sched->resched);
        }
+#else
+       resched = xnsched_resched_p(sched);
 #endif
        clrbits(sched->status, XNRESCHED);
        return resched;
diff --git a/ksrc/nucleus/sched.c b/ksrc/nucleus/sched.c
index 70e32d5..b2d8de2 100644
--- a/ksrc/nucleus/sched.c
+++ b/ksrc/nucleus/sched.c
@@ -154,7 +154,9 @@ void xnsched_init(struct xnsched *sched, int cpu)
        xntimer_set_name(&sched->htimer, htimer_name);
        xntimer_set_sched(&sched->htimer, sched);
        sched->zombie = NULL;
+#ifdef CONFIG_SMP
        xnarch_cpus_clear(sched->resched);
+#endif
 
        attr.flags = XNROOT | XNSTARTED | XNFPU;
        attr.name = root_name;


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

Reply via email to