From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Vivenzio Pagliari <vivenzio.pagliari@nokia.com>
Subject: [PATCH] sched: Change sysctl_sched_rt_period type to signed int
Date: Thu, 9 Jul 2015 09:45:40 +0200 [thread overview]
Message-ID: <559E26A4.8080100@nokia.com> (raw)
According to Documentation:
* sched_rt_period_us takes values from 1 to INT_MAX.
There is even check for this in sched_rt_global_validate(), but it doesn't work
because sysctl_sched_rt_period is unsigned int.
One could have an impression that check for negative values works, but it's only
because it's not possible to set global limit lower than cgroup limit and "-1"
will simply result in very low runtime to period ratio.
It's still possible to set sched_rt_runtime_us to "-1" and then set
sched_rt_period_us to "-1".
Let's change the type of sysctl_sched_rt_period to signed int, because
sched_rt_handler() uses proc_dointvec() to assign this variable and
global_rt_period() anyway converts it to u64.
After this change it's not possible to assign negative values to
sched_rt_period_us any more.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Reported-by: Vivenzio Pagliari <vivenzio.pagliari@nokia.com>
---
include/linux/sched/sysctl.h | 2 +-
kernel/sched/core.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 596a0e0..5d58dbb 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -82,7 +82,7 @@ static inline unsigned int get_sysctl_timer_migration(void)
* /proc/sys/kernel/sched_rt_period_us
* /proc/sys/kernel/sched_rt_runtime_us
*/
-extern unsigned int sysctl_sched_rt_period;
+extern int sysctl_sched_rt_period;
extern int sysctl_sched_rt_runtime;
#ifdef CONFIG_CFS_BANDWIDTH
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 1236732..7dda0cc 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -296,7 +296,7 @@ const_debug unsigned int sysctl_sched_time_avg = MSEC_PER_SEC;
* period over which we measure -rt task cpu usage in us.
* default: 1s
*/
-unsigned int sysctl_sched_rt_period = 1000000;
+int sysctl_sched_rt_period = 1000000;
__read_mostly int scheduler_running;
reply other threads:[~2015-07-09 7:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=559E26A4.8080100@nokia.com \
--to=alexander.sverdlin@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vivenzio.pagliari@nokia.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.