Re: SCHED_SPORADIC in Xenomai 3

Philippe Gerum <[email protected]>
Newsgroups dev.linux.lists.xenomai
Message-ID <[email protected]>
Jan Kiszka <[email protected]> writes:

> diff --git a/kernel/cobalt/sched.c b/kernel/cobalt/sched.c
> index d527b6be2c..6dfbf83220 100644
> --- a/kernel/cobalt/sched.c
> +++ b/kernel/cobalt/sched.c
> @@ -895,6 +895,7 @@ static inline void do_lazy_user_work(struct xnthread *curr)
>  
>  int ___xnsched_run(struct xnsched *sched)
>  {
> +	struct xnsched_class *prev_schedclass __maybe_unused;
>  	bool switched = false, leaving_inband;
>  	struct xnthread *prev, *next, *curr;
>  	spl_t s;
> @@ -933,6 +934,13 @@ int ___xnsched_run(struct xnsched *sched)
>  
>  	prev = curr;
>  
> +#ifdef CONFIG_XENO_OPT_SCHED_CLASSES
> +	prev_schedclass = prev->sched_class;
> +	if (prev_schedclass->weight < next->sched_class->weight &&
> +	    prev_schedclass->sched_out)
> +		prev_schedclass->sched_out(prev);
> +#endif

I would call the scheduling out hook unconditionally, the sched class
has all the information required to sort this out, do the right thing,
which the generic scheduler does not.
>
> Something analogous for sched-sporadic does not help. It looks broken in 
> its algorithm, specifically that is schedules consumed budget for 
> recharge on preemption, rather than reducing the remaining budget.

Since the original implementation did not account for the preemption
case in budget-tracking classes, that makes sense.

-- 
Philippe.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.