All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Richard Weinberger (sigma star gmbh)" <rw@kernel.org>
To: xenomai@lists.linux.dev
Cc: upstream+xenomai@sigma-star.at, Richard Weinberger <richard@nod.at>
Subject: [PATCH 3/5] cobalt/sched-sporadic: stop budget accounting on RT throttling
Date: Tue,  1 Dec 2026 15:12:05 +0100	[thread overview]
Message-ID: <20261201141207.2876277-4-rw@kernel.org> (raw)
In-Reply-To: <20261201141207.2876277-1-rw@kernel.org>

From: Richard Weinberger <richard@nod.at>

When RT throttling switches a sporadic thread out, sched_pick() is
bypassed and sporadic_suspend_activity() is not called. The drop
timer keeps running while the CPU is throttled, charging the thread
for time it did not run and possibly demoting it to its low priority.

Implement the sched_throttle hook to suspend budget accounting.

Signed-off-by: Richard Weinberger <richard@nod.at>
---
 kernel/cobalt/sched-sporadic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/cobalt/sched-sporadic.c b/kernel/cobalt/sched-sporadic.c
index bec8dcb53..78687bf92 100644
--- a/kernel/cobalt/sched-sporadic.c
+++ b/kernel/cobalt/sched-sporadic.c
@@ -395,6 +395,12 @@ swap:
 	return next;
 }
 
+static void xnsched_sporadic_throttle(struct xnthread *curr)
+{
+	if (curr->pss)
+		sporadic_suspend_activity(curr);
+}
+
 #ifdef CONFIG_XENO_OPT_VFILE
 
 struct xnvfile_directory sched_sporadic_vfroot;
@@ -549,6 +555,7 @@ struct xnsched_class xnsched_class_sporadic = {
 	.sched_declare		=	xnsched_sporadic_declare,
 	.sched_forget		=	xnsched_sporadic_forget,
 	.sched_kick		=	NULL,
+	.sched_throttle		=	xnsched_sporadic_throttle,
 #ifdef CONFIG_XENO_OPT_VFILE
 	.sched_init_vfile	=	xnsched_sporadic_init_vfile,
 	.sched_cleanup_vfile	=	xnsched_sporadic_cleanup_vfile,
-- 
2.56.1


  parent reply	other threads:[~2026-12-01 14:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 14:12 [RFC PATCH 0/5] RT throttling Richard Weinberger (sigma star gmbh)
2026-12-01 14:12 ` [PATCH 1/5] cobalt/trace: add cobalt_sched_throttle tracepoint Richard Weinberger (sigma star gmbh)
2026-12-01 14:12 ` [PATCH 2/5] cobalt/sched: add RT throttling Richard Weinberger (sigma star gmbh)
2026-12-01 14:12 ` Richard Weinberger (sigma star gmbh) [this message]
2026-12-01 14:12 ` [PATCH 4/5] cobalt/sched-quota: charge the running group on " Richard Weinberger (sigma star gmbh)
2026-12-01 14:12 ` [PATCH 5/5] testsuite/smokey: add sched-throttle test Richard Weinberger (sigma star gmbh)
2026-12-01 15:29 ` [RFC PATCH 0/5] RT throttling Jan Kiszka
2026-12-01 15:32   ` Richard Weinberger
2026-12-01 15:36     ` Jan Kiszka
2026-12-01 15:38       ` Richard Weinberger
2026-12-01 15:40         ` Jan Kiszka

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=20261201141207.2876277-4-rw@kernel.org \
    --to=rw@kernel.org \
    --cc=richard@nod.at \
    --cc=upstream+xenomai@sigma-star.at \
    --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.