mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Cyril Hrubis" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Cyril Hrubis <chrubis@suse.cz>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Petr Vorel <pvorel@suse.cz>, Mel Gorman <mgorman@suse.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset
Date: Mon, 14 Aug 2023 15:08:07 -0000	[thread overview]
Message-ID: <169202568750.27769.3498187925487799057.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20230802151906.25258-3-chrubis@suse.cz>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     c1fc6484e1fb7cc2481d169bfef129a1b0676abe
Gitweb:        https://git.kernel.org/tip/c1fc6484e1fb7cc2481d169bfef129a1b0676abe
Author:        Cyril Hrubis <chrubis@suse.cz>
AuthorDate:    Wed, 02 Aug 2023 17:19:06 +02:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Mon, 14 Aug 2023 17:01:23 +02:00

sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset

The sched_rr_timeslice can be reset to default by writing value that is
<= 0. However after reading from this file we always got the last value
written, which is not useful at all.

$ echo -1 > /proc/sys/kernel/sched_rr_timeslice_ms
$ cat /proc/sys/kernel/sched_rr_timeslice_ms
-1

Fix this by setting the variable that holds the sysctl file value to the
jiffies_to_msecs(RR_TIMESLICE) in case that <= 0 value was written.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Acked-by: Mel Gorman <mgorman@suse.de>
Tested-by: Petr Vorel <pvorel@suse.cz>
Link: https://lore.kernel.org/r/20230802151906.25258-3-chrubis@suse.cz
---
 kernel/sched/rt.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 185d3d7..0597ba0 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -3062,6 +3062,9 @@ static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
 		sched_rr_timeslice =
 			sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE :
 			msecs_to_jiffies(sysctl_sched_rr_timeslice);
+
+		if (sysctl_sched_rr_timeslice <= 0)
+			sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE);
 	}
 	mutex_unlock(&mutex);
 

  reply	other threads:[~2023-08-14 15:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02 15:19 [PATCH 0/2 RESEND] Two fixes for sysctl_sched_rr_timeslice Cyril Hrubis
2023-08-02 15:19 ` [PATCH 1/2 RESEND] sched/rt: Fix sysctl_sched_rr_timeslice intial value Cyril Hrubis
2023-08-14 15:08   ` [tip: sched/core] " tip-bot2 for Cyril Hrubis
2023-08-02 15:19 ` [PATCH 2/2 RESEND] sched/rt: sysctl_sched_rr_timeslice show default timeslice after reset Cyril Hrubis
2023-08-14 15:08   ` tip-bot2 for Cyril Hrubis [this message]
2023-08-10  8:30 ` [PATCH 0/2 RESEND] Two fixes for sysctl_sched_rr_timeslice Mel Gorman
2023-08-10 10:26   ` Peter Zijlstra

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=169202568750.27769.3498187925487799057.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=chrubis@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=peterz@infradead.org \
    --cc=pvorel@suse.cz \
    --cc=x86@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®