lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <169202568750.27769.3498187925487799057.tip-bot2@tip-bot2>
Date:   Mon, 14 Aug 2023 15:08:07 -0000
From:   "tip-bot2 for Cyril Hrubis" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Cyril Hrubis <chrubis@...e.cz>,
        "Peter Zijlstra (Intel)" <peterz@...radead.org>,
        Petr Vorel <pvorel@...e.cz>, Mel Gorman <mgorman@...e.de>,
        x86@...nel.org, linux-kernel@...r.kernel.org
Subject: [tip: sched/core] sched/rt: sysctl_sched_rr_timeslice show default
 timeslice after reset

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@...e.cz>
AuthorDate:    Wed, 02 Aug 2023 17:19:06 +02:00
Committer:     Peter Zijlstra <peterz@...radead.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@...e.cz>
Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
Reviewed-by: Petr Vorel <pvorel@...e.cz>
Acked-by: Mel Gorman <mgorman@...e.de>
Tested-by: Petr Vorel <pvorel@...e.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);
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ