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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Jul  2 09:18:41 2015 +0200

cobalt/sched: get rid of XNINLOCK scheduler flag

XNINLOCK and the per-thread scheduler lock nesting count are
redundant. Drop XNINLOCK which conveys less information.

---

 include/cobalt/kernel/sched.h |    9 ++++++---
 kernel/cobalt/sched.c         |   14 --------------
 kernel/cobalt/thread.c        |    1 -
 3 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/include/cobalt/kernel/sched.h b/include/cobalt/kernel/sched.h
index ecd9605..ca0f732 100644
--- a/include/cobalt/kernel/sched.h
+++ b/include/cobalt/kernel/sched.h
@@ -45,7 +45,6 @@
 #define XNHTICK                0x00008000      /* Host tick pending  */
 #define XNINIRQ                0x00004000      /* In IRQ handling context */
 #define XNHDEFER       0x00002000      /* Host tick deferred */
-#define XNINLOCK       0x00001000      /* Scheduler locked */
 
 struct xnsched_rt {
        xnsched_queue_t runnable;       /*!< Runnable thread queue. */
@@ -291,13 +290,17 @@ static inline int xnsched_run(void)
         * we are caught in the middle of an unlocked context switch.
         */
        if (((sched->status|sched->lflags) &
-            (XNINIRQ|XNINSW|XNRESCHED|XNINLOCK)) != XNRESCHED)
+            (XNINIRQ|XNINSW|XNRESCHED)) != XNRESCHED ||
+           sched->curr->lock_count > 0)
                return 0;
 
        return __xnsched_run(sched);
 }
 
-void ___xnsched_lock(struct xnsched *sched);
+static inline void ___xnsched_lock(struct xnsched *sched)
+{
+       sched->curr->lock_count++;
+}
 
 void ___xnsched_unlock(struct xnsched *sched);
 
diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
index bda61a6..73965e7 100644
--- a/kernel/cobalt/sched.c
+++ b/kernel/cobalt/sched.c
@@ -320,15 +320,6 @@ struct xnsched *xnsched_finish_unlocked_switch(struct 
xnsched *sched)
 
 #endif /* CONFIG_XENO_ARCH_UNLOCKED_SWITCH */
 
-void ___xnsched_lock(struct xnsched *sched)
-{
-       struct xnthread *curr = sched->curr;
-
-       if (curr->lock_count++ == 0)
-               sched->lflags |= XNINLOCK;
-}
-EXPORT_SYMBOL_GPL(___xnsched_lock);
-
 void ___xnsched_unlock(struct xnsched *sched)
 {
        struct xnthread *curr = sched->curr;
@@ -338,7 +329,6 @@ void ___xnsched_unlock(struct xnsched *sched)
 
        if (--curr->lock_count == 0) {
                xnthread_clear_info(curr, XNLBALERT);
-               sched->lflags &= ~XNINLOCK;
                xnsched_run();
        }
 }
@@ -350,7 +340,6 @@ void ___xnsched_unlock_fully(struct xnsched *sched)
 
        curr->lock_count = 0;
        xnthread_clear_info(curr, XNLBALERT);
-       sched->lflags &= ~XNINLOCK;
        xnsched_run();
 }
 EXPORT_SYMBOL_GPL(___xnsched_unlock_fully);
@@ -878,9 +867,6 @@ out:
            xnsched_maybe_resched_after_unlocked_switch(sched))
                goto reschedule;
 
-       if (curr->lock_count > 0)
-               sched->lflags |= XNINLOCK;
-
        xnlock_put_irqrestore(&nklock, s);
 
        return switched;
diff --git a/kernel/cobalt/thread.c b/kernel/cobalt/thread.c
index 07a39b6..541e8b1 100644
--- a/kernel/cobalt/thread.c
+++ b/kernel/cobalt/thread.c
@@ -920,7 +920,6 @@ void xnthread_suspend(struct xnthread *thread, int mask,
         */
        if (likely(thread == sched->curr)) {
                xnsched_set_resched(sched);
-               sched->lflags &= ~XNINLOCK;
                if (unlikely(mask & XNRELAX)) {
                        xnlock_clear_irqon(&nklock);
                        splmax();


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

Reply via email to