linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/rt: use DIV_ROUND_UP to calculate sysctl_sched_rr_timeslice
@ 2021-03-18  5:53 Hongchen Zhang
  0 siblings, 0 replies; only message in thread
From: Hongchen Zhang @ 2021-03-18  5:53 UTC (permalink / raw)
  To: mingo, peterz, linux-kernel

When HZ is 300, the value of sysctl_sched_rr_timeslice is different from
the actual value. Therefore, replace with DIV_ROUND_UP to calculate
sysctl_sched_rr_timeslice.

Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
---
 kernel/sched/rt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index b980cc96604f..c684440eefdb 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -8,7 +8,7 @@
 #include "pelt.h"
 
 int sched_rr_timeslice = RR_TIMESLICE;
-int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
+int sysctl_sched_rr_timeslice = DIV_ROUND_UP(RR_TIMESLICE * MSEC_PER_SEC, HZ);
 
 static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun);
 
-- 
2.27.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-18  5:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-18  5:53 [PATCH] sched/rt: use DIV_ROUND_UP to calculate sysctl_sched_rr_timeslice Hongchen Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).