[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230314031323.3638994-1-yajun.deng@linux.dev>
Date: Tue, 14 Mar 2023 11:13:23 +0800
From: Yajun Deng <yajun.deng@...ux.dev>
To: mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
vincent.guittot@...aro.org, dietmar.eggemann@....com,
rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
bristot@...hat.com, vschneid@...hat.com
Cc: linux-kernel@...r.kernel.org, Yajun Deng <yajun.deng@...ux.dev>
Subject: [PATCH] sched/rt: Reset sysctl_sched_rr_timeslice when it non-positive
When sysctl_sched_rr_timeslice was set a non-positive number, only
sched_rr_timeslice was reset to default, This behavior should let
users know.
So reset sysctl_sched_rr_timeslice at the same time when it
non-positive.
Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>
---
kernel/sched/rt.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 0a11f44adee5..0723a6297f96 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -3036,9 +3036,12 @@ static int sched_rr_handler(struct ctl_table *table, int write, void *buffer,
* Also, writing zero resets the timeslice to default:
*/
if (!ret && write) {
- sched_rr_timeslice =
- sysctl_sched_rr_timeslice <= 0 ? RR_TIMESLICE :
- msecs_to_jiffies(sysctl_sched_rr_timeslice);
+ if (sysctl_sched_rr_timeslice > 0)
+ sched_rr_timeslice = msecs_to_jiffies(sysctl_sched_rr_timeslice);
+ else {
+ sched_rr_timeslice = RR_TIMESLICE;
+ sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
+ }
}
mutex_unlock(&mutex);
--
2.25.1
Powered by blists - more mailing lists