[Xenomai-git] Philippe Gerum : cobalt/sched: do not choke on redundant policy setting
Module: xenomai-3 Branch: master Commit: d2bc78c45e322451a46dcbe0de75a09f304c1c57 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d2bc78c45e322451a46dcbe0de75a09f304c1c57 Author: Philippe Gerum r...@xenomai.org Date: Tue Mar 17 09:11:21 2015 +0100 cobalt/sched: do not choke on redundant policy setting Setting the base scheduling class of a thread to the current value should not cause such thread to be declared again to the policy module. It is not only useless, but declaration handlers are not expected to cope with such situation. See http://www.xenomai.org/pipermail/xenomai/2015-March/033563.html. --- kernel/cobalt/sched.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index a6469db..f57570e 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -387,9 +387,11 @@ int xnsched_set_policy(struct xnthread *thread, * affect the previous class (such as touching thread-rlink * for instance). */ - ret = xnsched_declare(sched_class, thread, p); - if (ret) - return ret; + if (sched_class != thread-base_class) { + ret = xnsched_declare(sched_class, thread, p); + if (ret) + return ret; + } /* * As a special case, we may be called from __xnthread_init() ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/sched: do not choke on redundant policy setting
Module: xenomai-3 Branch: next Commit: d2bc78c45e322451a46dcbe0de75a09f304c1c57 URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=d2bc78c45e322451a46dcbe0de75a09f304c1c57 Author: Philippe Gerum r...@xenomai.org Date: Tue Mar 17 09:11:21 2015 +0100 cobalt/sched: do not choke on redundant policy setting Setting the base scheduling class of a thread to the current value should not cause such thread to be declared again to the policy module. It is not only useless, but declaration handlers are not expected to cope with such situation. See http://www.xenomai.org/pipermail/xenomai/2015-March/033563.html. --- kernel/cobalt/sched.c |8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c index a6469db..f57570e 100644 --- a/kernel/cobalt/sched.c +++ b/kernel/cobalt/sched.c @@ -387,9 +387,11 @@ int xnsched_set_policy(struct xnthread *thread, * affect the previous class (such as touching thread-rlink * for instance). */ - ret = xnsched_declare(sched_class, thread, p); - if (ret) - return ret; + if (sched_class != thread-base_class) { + ret = xnsched_declare(sched_class, thread, p); + if (ret) + return ret; + } /* * As a special case, we may be called from __xnthread_init() ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git