Skip to contentSkip to conversation

sched: rt: document the risk of small values in the bandwidth settings

PATCH In review Peter Zijlstra 2 participants 4 messages May 4, 2009 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: rt: document the risk of small values in the bandwidth settings

Thomas noted that we should disallow sysctl_sched_rt_runtime == 0 for (! RT_GROUP) since the root group always has some RT tasks in it.

Further, update the documentation to inspire clue.

---
 Documentation/scheduler/sched-rt-group.txt |   18 ++++++++++++++++++
 kernel/sched.c                             |    7 +++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
Documentation/scheduler/sched-rt-group.txt +18 -0
index 5ba4d3f..cfd51c0 100644
@@ -4,6 +4,7 @@
 CONTENTS
 ========
 
+0. WARNING
 1. Overview
   1.1 The problem
   1.2 The solution
@@ -14,6 +15,23 @@ CONTENTS
 3. Future plans
 
 
+0. WARNING
+==========
+
+Fiddling with these settings can result in an unusable system, the knobs are
+root only and assume root knows what he's on about.
+
+Most notable:
+ 
+ * very small values in sched_rt_period_us can result in an unstable
+   system when the period is smaller than either the available hrtimer
+   resolution, or the time it takes to handle the budget refresh itself.
+
+ * very small values in sched_rt_runtime_us can result in an unstable
+   system when the runtime is so small the system has difficulty making
+   forward progress (NOTE: the migration thread and kstopmachine both
+   are real-time processes).
+
 1. Overview
 ===========
 
kernel/sched.c +7 -0
index 11f6da4..c5ef114 100644
@@ -10021,6 +10021,13 @@ static int sched_rt_global_constraints(void)
 	if (sysctl_sched_rt_period <= 0)
 		return -EINVAL;
 
+	/*
+	 * There's always some RT tasks in the root group
+	 * -- migration, kstopmachine etc..
+	 */
+	if (sysctl_sched_rt_runtime == 0)
+		return -EBUSY;
+
 	spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
 	for_each_possible_cpu(i) {
 		struct rt_rq *rt_rq = &cpu_rq(i)->rt;
#1 lore raw
Quoted 25 lines · Peter Zijlstra

Thomas noted that we should disallow sysctl_sched_rt_runtime == 0 for (! RT_GROUP) since the root group always has some RT tasks in it.

Further, update the documentation to inspire clue.

---
 Documentation/scheduler/sched-rt-group.txt |   18 ++++++++++++++++++
 kernel/sched.c                             |    7 +++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
Documentation/scheduler/sched-rt-group.txt +1 -0
index 5ba4d3f..cfd51c0 100644
@@ -4,6 +4,7 @@
 CONTENTS
 ========
 
+0. WARNING
 1. Overview
   1.1 The problem
   1.2 The solution

Documentation/scheduler/sched-rt-group.txt CONTENTS · line 22

Quoted 8 lines
Documentation/scheduler/sched-rt-group.txt +5 -0
@@ -14,6 +15,23 @@ CONTENTS
 3. Future plans
 
 
+0. WARNING
+==========
+
+Fiddling with these settings can result in an unusable system, the knobs are
+root only and assume root knows what he's on about.

I know that my English is limited, but I don't know what this means:
"what he's on about."

Quoted 35 lines
Documentation/scheduler/sched-rt-group.txt +12 -0
+
+Most notable:
+ 
+ * very small values in sched_rt_period_us can result in an unstable
+   system when the period is smaller than either the available hrtimer
+   resolution, or the time it takes to handle the budget refresh itself.
+
+ * very small values in sched_rt_runtime_us can result in an unstable
+   system when the runtime is so small the system has difficulty making
+   forward progress (NOTE: the migration thread and kstopmachine both
+   are real-time processes).
+
 1. Overview
 ===========
 
kernel/sched.c +7 -1
index 11f6da4..c5ef114 100644
@@ -10021,6 +10021,13 @@ static int sched_rt_global_constraints(void)
 	if (sysctl_sched_rt_period <= 0)
 		return -EINVAL;
 
+	/*
+	 * There's always some RT tasks in the root group
+	 * -- migration, kstopmachine etc..
+	 */
+	if (sysctl_sched_rt_runtime == 0)
+		return -EBUSY;
+
 	spin_lock_irqsave(&def_rt_bandwidth.rt_runtime_lock, flags);
 	for_each_possible_cpu(i) {
 		struct rt_rq *rt_rq = &cpu_rq(i)->rt;
 
--
Signature · 1 line
~Randy
#2 lore raw
Quoted 5 lines · Randy Dunlap

Documentation/scheduler/sched-rt-group.txt CONTENTS · line 22

Quoted 2 lines
Documentation/scheduler/sched-rt-group.txt +2 -0
+Fiddling with these settings can result in an unusable system, the knobs are
+root only and assume root knows what he's on about.

I know that my English is limited, but I don't know what this means:
"what he's on about."

Hehe, OK, how about we write it like:

Fiddling with these settings can result in an unstable system, the knobs are root only and assumes root knows what he is doing.

Does that work better for you?

#3 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 4 lines · Randy Dunlap

Documentation/scheduler/sched-rt-group.txt CONTENTS · line 22

Quoted 2 lines
Documentation/scheduler/sched-rt-group.txt +2 -0
+Fiddling with these settings can result in an unusable system, the knobs are
+root only and assume root knows what he's on about.

I know that my English is limited, but I don't know what this means:
"what he's on about."

Quoted 6 lines

Hehe, OK, how about we write it like:

Fiddling with these settings can result in an unstable system, the knobs are root only and assumes root knows what he is doing.

Does that work better for you?

Yes, thanks.

Signature · 1 line
~Randy