Module: xenomai-head Branch: master Commit: 25435b03f8bcd76bdaa362a9f5db1a03586a95f8 URL: http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=25435b03f8bcd76bdaa362a9f5db1a03586a95f8
Author: Philippe Gerum <r...@xenomai.org> Date: Sun Oct 10 12:51:34 2010 +0200 nucleus: introduce XNOTHER in thread state bits We need a way to identify non real-time shadow threads quickly. This patch introduces the XNOTHER bit in the per-thread state word to this end. --- include/nucleus/thread.h | 1 + ksrc/nucleus/pod.c | 10 ++++++++++ ksrc/nucleus/shadow.c | 5 +++++ 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/include/nucleus/thread.h b/include/nucleus/thread.h index 0b13309..725233f 100644 --- a/include/nucleus/thread.h +++ b/include/nucleus/thread.h @@ -62,6 +62,7 @@ #define XNFPU 0x00100000 /**< Thread uses FPU */ #define XNSHADOW 0x00200000 /**< Shadow thread */ #define XNROOT 0x00400000 /**< Root thread (that is, Linux/IDLE) */ +#define XNOTHER 0x00800000 /**< Non real-time shadow (prio=0) */ /*! @} */ /* Ends doxygen comment group: nucleus_state_flags */ diff --git a/ksrc/nucleus/pod.c b/ksrc/nucleus/pod.c index fb1f9cb..862838c 100644 --- a/ksrc/nucleus/pod.c +++ b/ksrc/nucleus/pod.c @@ -1898,6 +1898,16 @@ int __xnpod_set_thread_schedparam(struct xnthread *thread, xnsched_putback(thread); #ifdef CONFIG_XENO_OPT_PERVASIVE + /* + * A non-real-time shadow may upgrade to real-time FIFO + * scheduling, but the latter may never downgrade to + * SCHED_NORMAL Xenomai-wise. In the valid case, we clear + * XNOTHER to reflect the change. Note that we keep handling + * non real-time shadow specifics in higher code layers, not + * to pollute the core scheduler with peculiarities. + */ + if (sched_class == &xnsched_class_rt && sched_param->rt.prio > 0) + xnthread_clear_state(thread, XNOTHER); if (propagate) { if (xnthread_test_state(thread, XNRELAX)) xnshadow_renice(thread); diff --git a/ksrc/nucleus/shadow.c b/ksrc/nucleus/shadow.c index 586a08a..b25423c 100644 --- a/ksrc/nucleus/shadow.c +++ b/ksrc/nucleus/shadow.c @@ -1374,6 +1374,11 @@ int xnshadow_map(xnthread_t *thread, xncompletion_t __user *u_completion, thread->u_mode = u_mode; + if (xnthread_base_priority(thread) == 0 && + current->policy == SCHED_NORMAL) + /* Non real-time shadow. */ + xnthread_set_state(thread, XNOTHER); + if (u_completion) { /* * Send the renice signal if we are not migrating so that user _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git