Module: xenomai-2.5 Branch: master Commit: 376edf76951bb397abd4882a870af9df4a4cdd50 URL: http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=376edf76951bb397abd4882a870af9df4a4cdd50
Author: Jan Kiszka <[email protected]> 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 <[email protected]> --- 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 bc24c22..de57902 100644 --- a/include/nucleus/sched.h +++ b/include/nucleus/sched.h @@ -67,7 +67,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 @@ -177,10 +179,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__)) \ @@ -191,6 +195,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 7ac9a32..617c34d 100644 --- a/ksrc/nucleus/pod.c +++ b/ksrc/nucleus/pod.c @@ -2168,6 +2168,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 25ff553..10ce312 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 [email protected] https://mail.gna.org/listinfo/xenomai-git
