All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Xenomai <xenomai@lists.linux.dev>
Subject: Re: SCHED_SPORADIC in Xenomai 3
Date: Thu, 11 Jun 2026 09:49:25 +0200	[thread overview]
Message-ID: <87y0glbjp6.fsf@xenomai.org> (raw)
In-Reply-To: <30be9f34-4fd0-47fc-932f-70970217acb0@siemens.com> (Jan Kiszka's message of "Thu, 11 Jun 2026 07:38:57 +0200")

Jan Kiszka <jan.kiszka@siemens.com> 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.

  reply	other threads:[~2026-06-11  7:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  6:24 SCHED_SPORADIC in Xenomai 3 Jan Kiszka
2026-06-10  7:21 ` Jan Kiszka
2026-06-10  7:33   ` Jan Kiszka
2026-06-10 18:17     ` Jan Kiszka
2026-06-11  5:38       ` Jan Kiszka
2026-06-11  7:49         ` Philippe Gerum [this message]
2026-06-11  7:56           ` Jan Kiszka
2026-06-11  8:53             ` Philippe Gerum
2026-06-11  7:36       ` Philippe Gerum
2026-06-11  7:33 ` Philippe Gerum
2026-06-11  7:42   ` Jan Kiszka
2026-06-11  7:56     ` Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y0glbjp6.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.