Message ID | 20231018081709.2289264-1-yajun.deng@linux.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4638955vqb; Wed, 18 Oct 2023 01:17:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSNWY6fYz4Iwi7eGFu+tkKfOTJgn+/jLOc7XcgO5mqajiSuGxXYJ9BMbKtpW1aMFWkORLc X-Received: by 2002:a17:90b:3b81:b0:27d:2261:73e4 with SMTP id pc1-20020a17090b3b8100b0027d226173e4mr4906242pjb.2.1697617071605; Wed, 18 Oct 2023 01:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697617071; cv=none; d=google.com; s=arc-20160816; b=tGSovnWRh2PEzUsLmtSjmXQeaQiBNkfa0lwNCu5oPFvRy20u5t4gjR27EIs0GcLlfi ft3FEn5uCAg+KzW/FtIv1GyIipe7IGzAmJViG646N9ry3wGdqn+yEFGyQZ5nefFaQWkM /sRdUMovBZr5eem9eOpnIRPmFC2E/Mj8Apd/qdj1iR5uTCS8AtQUaxtwCeZsIht/cqWL urFgZtrm2Akn5v8ujPxzwAXFHuwnHKe4nsjf6/Wu6bah97SP3h/BMqM+krEiSmpiAf1k dEbO375HRju/DuRzwKbt7KnT7VEN7DxXHZvwBTYI5PhepN7Aww81EvYPSsoFYvfLf3LF fG/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zy9fCLbPUi1k7I58SOVdMfFxEcUzWTJduGQe7dU0lhM=; fh=kY5sJNvn29qhEh2SatEVpXE2cTkcQ8AnU+xu9Bnn8Ic=; b=X2fP0VxtP+5xWvAqTxaZbfpZqaqI4klTwXXrMGonQIX9WSn8nZoeS3gMbjSN7XiZ5B tAt/gPmLdFcgcfzCMbmknla05jMH9jvCtTKe1eV/J1QvrYaxqpHwlBYQn7ugzxLZd97f 54BbA3pM8V6ELy3OYxYgJO97dqe0nJCkqLXHIT8FDYDBpGaqQEz+/BfnStS0S+kbuy47 0swGifrwzqonE7D+M7mgwY3fIdjUvDuGvE/hw/5Sd8hwAFhl13WhYHUZDTrsZruvXNK2 N+WoXFVdJEw/r5XA1ZE/eSHuau0czGu6TFLoSkTMYDVQUJLMRcKJ8Ug5zed1AzJ3D91H QWJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=V7UUY9fY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id x65-20020a17090a6c4700b00277382d4803si995237pjj.173.2023.10.18.01.17.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 01:17:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=V7UUY9fY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id E659980239D9; Wed, 18 Oct 2023 01:17:48 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230059AbjJRIRg (ORCPT <rfc822;lkml4gm@gmail.com> + 24 others); Wed, 18 Oct 2023 04:17:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbjJRIRf (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 18 Oct 2023 04:17:35 -0400 Received: from out-194.mta1.migadu.com (out-194.mta1.migadu.com [95.215.58.194]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4648FB6 for <linux-kernel@vger.kernel.org>; Wed, 18 Oct 2023 01:17:33 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1697617051; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=zy9fCLbPUi1k7I58SOVdMfFxEcUzWTJduGQe7dU0lhM=; b=V7UUY9fYnMYUrI7HTAKqUnv8vta2FjvG4b4iEezqly4j9H/tCTnclqeth87vfr/Zr8iNZh j+LhXB9jAox5w5tXgOmiWFuWSL1ovhPuXHaK8z/EqkN0Uys+PuPoR6aqGGjmct6VWFW4Ln /us3zhaqmPTZXMPBmv8pWZb88wCzsGU= From: Yajun Deng <yajun.deng@linux.dev> To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com Cc: linux-kernel@vger.kernel.org, Yajun Deng <yajun.deng@linux.dev> Subject: [PATCH] sched/rt: Redefine RR_TIMESLICE to 100 msecs Date: Wed, 18 Oct 2023 16:17:09 +0800 Message-Id: <20231018081709.2289264-1-yajun.deng@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 01:17:49 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780080518300721336 X-GMAIL-MSGID: 1780080518300721336 |
Series |
sched/rt: Redefine RR_TIMESLICE to 100 msecs
|
|
Commit Message
Yajun Deng
Oct. 18, 2023, 8:17 a.m. UTC
The RR_TIMESLICE is currently defined as the jiffies corresponding to
100 msecs. And then sysctl_sched_rr_timeslice will convert RR_TIMESLICE
to 100 msecs. These are opposite calculations.
There are msecs_to_jiffies and jiffies_to_msecs in sched_rr_handler.
These are also opposite calculations.
Redefine RR_TIMESLICE to 100 msecs, only sched_rr_timeslice needs to
convert RR_TIMESLICE to jiffies.
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
---
include/linux/sched/rt.h | 2 +-
init/init_task.c | 2 +-
kernel/sched/rt.c | 12 +++++-------
3 files changed, 7 insertions(+), 9 deletions(-)
Comments
Kindly ping... Thanks On 2023/10/18 16:17, Yajun Deng wrote: > The RR_TIMESLICE is currently defined as the jiffies corresponding to > 100 msecs. And then sysctl_sched_rr_timeslice will convert RR_TIMESLICE > to 100 msecs. These are opposite calculations. > > There are msecs_to_jiffies and jiffies_to_msecs in sched_rr_handler. > These are also opposite calculations. > > Redefine RR_TIMESLICE to 100 msecs, only sched_rr_timeslice needs to > convert RR_TIMESLICE to jiffies. > > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > --- > include/linux/sched/rt.h | 2 +- > init/init_task.c | 2 +- > kernel/sched/rt.c | 12 +++++------- > 3 files changed, 7 insertions(+), 9 deletions(-) > > diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h > index b2b9e6eb9683..74f8f456a804 100644 > --- a/include/linux/sched/rt.h > +++ b/include/linux/sched/rt.h > @@ -58,6 +58,6 @@ extern void normalize_rt_tasks(void); > * default timeslice is 100 msecs (used only for SCHED_RR tasks). > * Timeslices get refilled after they expire. > */ > -#define RR_TIMESLICE (100 * HZ / 1000) > +#define RR_TIMESLICE (100) > > #endif /* _LINUX_SCHED_RT_H */ > diff --git a/init/init_task.c b/init/init_task.c > index 5727d42149c3..86619a425342 100644 > --- a/init/init_task.c > +++ b/init/init_task.c > @@ -94,7 +94,7 @@ struct task_struct init_task > }, > .rt = { > .run_list = LIST_HEAD_INIT(init_task.rt.run_list), > - .time_slice = RR_TIMESLICE, > + .time_slice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC, > }, > .tasks = LIST_HEAD_INIT(init_task.tasks), > #ifdef CONFIG_SMP > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 6aaf0a3d6081..7c0e912094a9 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -4,7 +4,7 @@ > * policies) > */ > > -int sched_rr_timeslice = RR_TIMESLICE; > +int sched_rr_timeslice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC; > /* More than 4 hours if BW_SHIFT equals 20. */ > static const u64 max_rt_runtime = MAX_BW; > > @@ -25,7 +25,7 @@ int sysctl_sched_rt_period = 1000000; > int sysctl_sched_rt_runtime = 950000; > > #ifdef CONFIG_SYSCTL > -static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ; > +static int sysctl_sched_rr_timeslice = RR_TIMESLICE; > static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, > size_t *lenp, loff_t *ppos); > static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, > @@ -3014,12 +3014,10 @@ 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) > - sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE); > + sysctl_sched_rr_timeslice = RR_TIMESLICE; > + > + sched_rr_timeslice = msecs_to_jiffies(sysctl_sched_rr_timeslice); > } > mutex_unlock(&mutex); >
On Wed, 18 Oct 2023 16:17:09 +0800 Yajun Deng <yajun.deng@linux.dev> wrote: > The RR_TIMESLICE is currently defined as the jiffies corresponding to > 100 msecs. And then sysctl_sched_rr_timeslice will convert RR_TIMESLICE > to 100 msecs. These are opposite calculations. Do we care? The compiler will do this at build time. What's wrong with the current code? > > There are msecs_to_jiffies and jiffies_to_msecs in sched_rr_handler. > These are also opposite calculations. > > Redefine RR_TIMESLICE to 100 msecs, only sched_rr_timeslice needs to > convert RR_TIMESLICE to jiffies. Why? What's the difference if we do it in one place or another? The calculations are done at compile time anyway. There's no performance benefit by this change. > > Signed-off-by: Yajun Deng <yajun.deng@linux.dev> > --- > include/linux/sched/rt.h | 2 +- > init/init_task.c | 2 +- > kernel/sched/rt.c | 12 +++++------- > 3 files changed, 7 insertions(+), 9 deletions(-) > > diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h > index b2b9e6eb9683..74f8f456a804 100644 > --- a/include/linux/sched/rt.h > +++ b/include/linux/sched/rt.h > @@ -58,6 +58,6 @@ extern void normalize_rt_tasks(void); > * default timeslice is 100 msecs (used only for SCHED_RR tasks). > * Timeslices get refilled after they expire. > */ > -#define RR_TIMESLICE (100 * HZ / 1000) > +#define RR_TIMESLICE (100) If anything, if this change is accepted, the above should be renamed to RR_TIMESLICE_MS to explicitly state that they are in milliseconds. > > #endif /* _LINUX_SCHED_RT_H */ > diff --git a/init/init_task.c b/init/init_task.c > index 5727d42149c3..86619a425342 100644 > --- a/init/init_task.c > +++ b/init/init_task.c > @@ -94,7 +94,7 @@ struct task_struct init_task > }, > .rt = { > .run_list = LIST_HEAD_INIT(init_task.rt.run_list), > - .time_slice = RR_TIMESLICE, > + .time_slice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC, > }, > .tasks = LIST_HEAD_INIT(init_task.tasks), > #ifdef CONFIG_SMP > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c > index 6aaf0a3d6081..7c0e912094a9 100644 > --- a/kernel/sched/rt.c > +++ b/kernel/sched/rt.c > @@ -4,7 +4,7 @@ > * policies) > */ > > -int sched_rr_timeslice = RR_TIMESLICE; > +int sched_rr_timeslice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC; > /* More than 4 hours if BW_SHIFT equals 20. */ > static const u64 max_rt_runtime = MAX_BW; > > @@ -25,7 +25,7 @@ int sysctl_sched_rt_period = 1000000; > int sysctl_sched_rt_runtime = 950000; > > #ifdef CONFIG_SYSCTL > -static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ; > +static int sysctl_sched_rr_timeslice = RR_TIMESLICE; So you are just moving calculations around that get done at compile time? > static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, > size_t *lenp, loff_t *ppos); > static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, > @@ -3014,12 +3014,10 @@ 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) > - sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE); > + sysctl_sched_rr_timeslice = RR_TIMESLICE; > + > + sched_rr_timeslice = msecs_to_jiffies(sysctl_sched_rr_timeslice); If anything, this patch may make this code easier to follow, but it's up to Peter if he wants to take it or not. Agnostic-by: Steven Rostedt (Google) <rostedt@goodmis.org> -- Steve > } > mutex_unlock(&mutex); >
On 2023/11/9 00:55, Steven Rostedt wrote: > On Wed, 18 Oct 2023 16:17:09 +0800 > Yajun Deng <yajun.deng@linux.dev> wrote: > >> The RR_TIMESLICE is currently defined as the jiffies corresponding to >> 100 msecs. And then sysctl_sched_rr_timeslice will convert RR_TIMESLICE >> to 100 msecs. These are opposite calculations. > Do we care? The compiler will do this at build time. What's wrong with the > current code? Yes, two calculations may introduce rounding error like the following. >> There are msecs_to_jiffies and jiffies_to_msecs in sched_rr_handler. >> These are also opposite calculations. >> >> Redefine RR_TIMESLICE to 100 msecs, only sched_rr_timeslice needs to >> convert RR_TIMESLICE to jiffies. > Why? What's the difference if we do it in one place or another? The > calculations are done at compile time anyway. There's no performance > benefit by this change. > The current code requires two calculations, it only needs to be calculated once after this patch. >> Signed-off-by: Yajun Deng <yajun.deng@linux.dev> >> --- >> include/linux/sched/rt.h | 2 +- >> init/init_task.c | 2 +- >> kernel/sched/rt.c | 12 +++++------- >> 3 files changed, 7 insertions(+), 9 deletions(-) >> >> diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h >> index b2b9e6eb9683..74f8f456a804 100644 >> --- a/include/linux/sched/rt.h >> +++ b/include/linux/sched/rt.h >> @@ -58,6 +58,6 @@ extern void normalize_rt_tasks(void); >> * default timeslice is 100 msecs (used only for SCHED_RR tasks). >> * Timeslices get refilled after they expire. >> */ >> -#define RR_TIMESLICE (100 * HZ / 1000) >> +#define RR_TIMESLICE (100) > If anything, if this change is accepted, the above should be renamed to > RR_TIMESLICE_MS to explicitly state that they are in milliseconds. Okay. >> >> #endif /* _LINUX_SCHED_RT_H */ >> diff --git a/init/init_task.c b/init/init_task.c >> index 5727d42149c3..86619a425342 100644 >> --- a/init/init_task.c >> +++ b/init/init_task.c >> @@ -94,7 +94,7 @@ struct task_struct init_task >> }, >> .rt = { >> .run_list = LIST_HEAD_INIT(init_task.rt.run_list), >> - .time_slice = RR_TIMESLICE, >> + .time_slice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC, >> }, >> .tasks = LIST_HEAD_INIT(init_task.tasks), >> #ifdef CONFIG_SMP >> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c >> index 6aaf0a3d6081..7c0e912094a9 100644 >> --- a/kernel/sched/rt.c >> +++ b/kernel/sched/rt.c >> @@ -4,7 +4,7 @@ >> * policies) >> */ >> >> -int sched_rr_timeslice = RR_TIMESLICE; >> +int sched_rr_timeslice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC; >> /* More than 4 hours if BW_SHIFT equals 20. */ >> static const u64 max_rt_runtime = MAX_BW; >> >> @@ -25,7 +25,7 @@ int sysctl_sched_rt_period = 1000000; >> int sysctl_sched_rt_runtime = 950000; >> >> #ifdef CONFIG_SYSCTL >> -static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ; >> +static int sysctl_sched_rr_timeslice = RR_TIMESLICE; > So you are just moving calculations around that get done at compile time? > It's a constant which avoids the rounding error in the calculation. Like commit: c7fcb99877f9 ("sched/rt: Fix sysctl_sched_rr_timeslice intial value" ). >> static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, >> size_t *lenp, loff_t *ppos); >> static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, >> @@ -3014,12 +3014,10 @@ 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) >> - sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE); >> + sysctl_sched_rr_timeslice = RR_TIMESLICE; >> + >> + sched_rr_timeslice = msecs_to_jiffies(sysctl_sched_rr_timeslice); > If anything, this patch may make this code easier to follow, but it's up to > Peter if he wants to take it or not. > > Agnostic-by: Steven Rostedt (Google) <rostedt@goodmis.org> > > -- Steve > > > >> } >> mutex_unlock(&mutex); >>
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index b2b9e6eb9683..74f8f456a804 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h @@ -58,6 +58,6 @@ extern void normalize_rt_tasks(void); * default timeslice is 100 msecs (used only for SCHED_RR tasks). * Timeslices get refilled after they expire. */ -#define RR_TIMESLICE (100 * HZ / 1000) +#define RR_TIMESLICE (100) #endif /* _LINUX_SCHED_RT_H */ diff --git a/init/init_task.c b/init/init_task.c index 5727d42149c3..86619a425342 100644 --- a/init/init_task.c +++ b/init/init_task.c @@ -94,7 +94,7 @@ struct task_struct init_task }, .rt = { .run_list = LIST_HEAD_INIT(init_task.rt.run_list), - .time_slice = RR_TIMESLICE, + .time_slice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC, }, .tasks = LIST_HEAD_INIT(init_task.tasks), #ifdef CONFIG_SMP diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 6aaf0a3d6081..7c0e912094a9 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -4,7 +4,7 @@ * policies) */ -int sched_rr_timeslice = RR_TIMESLICE; +int sched_rr_timeslice = (RR_TIMESLICE * HZ) / MSEC_PER_SEC; /* More than 4 hours if BW_SHIFT equals 20. */ static const u64 max_rt_runtime = MAX_BW; @@ -25,7 +25,7 @@ int sysctl_sched_rt_period = 1000000; int sysctl_sched_rt_runtime = 950000; #ifdef CONFIG_SYSCTL -static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ; +static int sysctl_sched_rr_timeslice = RR_TIMESLICE; static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos); static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, @@ -3014,12 +3014,10 @@ 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) - sysctl_sched_rr_timeslice = jiffies_to_msecs(RR_TIMESLICE); + sysctl_sched_rr_timeslice = RR_TIMESLICE; + + sched_rr_timeslice = msecs_to_jiffies(sysctl_sched_rr_timeslice); } mutex_unlock(&mutex);