Module: xenomai-forge
Branch: next
Commit: 71d75973abb660a5cc26bc43cec540bc859caafb
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=71d75973abb660a5cc26bc43cec540bc859caafb

Author: Philippe Gerum <r...@xenomai.org>
Date:   Tue Jul 30 16:17:35 2013 +0200

cobalt/sched: do not store cpu number in uniprocessor mode

---

 include/cobalt/kernel/sched.h |    2 +-
 kernel/cobalt/sched.c         |   17 +++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index a2d18e3..a5acc16 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -58,9 +58,9 @@ typedef struct xnsched {
 
        unsigned long status;           /*!< Scheduler specific status bitmask. 
*/
        unsigned long lflags;           /*!< Scheduler specific local flags 
bitmask. */
-       int cpu;
        struct xnthread *curr;          /*!< Current thread. */
 #ifdef CONFIG_SMP
+       int cpu;
        cpumask_t resched;              /*!< Mask of CPUs needing rescheduling. 
*/
 #endif
        struct xnsched_rt rt;           /*!< Context of built-in real-time 
class. */
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index b97d3a2..1769586 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -121,20 +121,20 @@ void xnsched_init(struct xnsched *sched, int cpu)
        struct xnthread_init_attr attr;
        struct xnsched_class *p;
 
-       sched->cpu = cpu;
-
-       for_each_xnsched_class(p) {
-               if (p->sched_init)
-                       p->sched_init(sched);
-       }
-
 #ifdef CONFIG_SMP
+       sched->cpu = cpu;
        sprintf(htimer_name, "[host-timer/%u]", cpu);
        sprintf(root_name, "ROOT/%u", cpu);
+       cpus_clear(sched->resched);
 #else
        strcpy(htimer_name, "[host-timer]");
        strcpy(root_name, "ROOT");
 #endif
+       for_each_xnsched_class(p) {
+               if (p->sched_init)
+                       p->sched_init(sched);
+       }
+
        sched->status = 0;
        sched->lflags = 0;
        sched->inesting = 0;
@@ -149,9 +149,6 @@ 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
-       cpus_clear(sched->resched);
-#endif
 
        attr.flags = XNROOT | XNSTARTED | XNFPU;
        attr.name = root_name;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to