diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2012-11-01 18:48:11 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2012-11-15 16:16:45 +0100 |
commit | bb11271068ff34434f5b8cefd0c2c0bae5ed7fd1 (patch) | |
tree | 56195078c0c89146b7bf442d4569fe305ebc498f /test | |
parent | 71c015969233c21ea38b1e63993d02fe171df672 (diff) | |
download | systemd-bb11271068ff34434f5b8cefd0c2c0bae5ed7fd1.tar.gz |
sched: Only setting CPUSchedulingPriority=rr doesn't work
A service that only sets the scheduling policy to round-robin
fails to be started. This is because the cpu_sched_priority is
initialized to 0 and is not adjusted when the policy is changed.
Clamp the cpu_sched_priority when the scheduler policy is set. Use
the current policy to validate the new priority.
Change the manual page to state that the given range only applies
to the real-time scheduling policies.
Add a testcase that verifies this change:
$ make test-sched-prio; ./test-sched-prio
[test/sched_idle_bad.service:6] CPU scheduling priority is out of range, ignoring: 1
[test/sched_rr_bad.service:7] CPU scheduling priority is out of range, ignoring: 0
[test/sched_rr_bad.service:8] CPU scheduling priority is out of range, ignoring: 100
Diffstat (limited to 'test')
-rw-r--r-- | test/sched_idle_bad.service | 6 | ||||
-rw-r--r-- | test/sched_idle_ok.service | 6 | ||||
-rw-r--r-- | test/sched_rr_bad.service | 8 | ||||
-rw-r--r-- | test/sched_rr_change.service | 9 | ||||
-rw-r--r-- | test/sched_rr_ok.service | 6 |
5 files changed, 35 insertions, 0 deletions
diff --git a/test/sched_idle_bad.service b/test/sched_idle_bad.service new file mode 100644 index 0000000000..589a87ccfd --- /dev/null +++ b/test/sched_idle_bad.service @@ -0,0 +1,6 @@ +[Unit] +Description=Bad sched priority for Idle + +[Service] +ExecStart=/bin/true +CPUSchedulingPriority=1 diff --git a/test/sched_idle_ok.service b/test/sched_idle_ok.service new file mode 100644 index 0000000000..262ef3e319 --- /dev/null +++ b/test/sched_idle_ok.service @@ -0,0 +1,6 @@ +[Unit] +Description=Sched idle with prio 0 + +[Service] +ExecStart=/bin/true +CPUSchedulingPriority=0 diff --git a/test/sched_rr_bad.service b/test/sched_rr_bad.service new file mode 100644 index 0000000000..0be534a546 --- /dev/null +++ b/test/sched_rr_bad.service @@ -0,0 +1,8 @@ +[Unit] +Description=Bad sched priority for RR + +[Service] +ExecStart=/bin/true +CPUSchedulingPolicy=rr +CPUSchedulingPriority=0 +CPUSchedulingPriority=100 diff --git a/test/sched_rr_change.service b/test/sched_rr_change.service new file mode 100644 index 0000000000..b3e3a000f8 --- /dev/null +++ b/test/sched_rr_change.service @@ -0,0 +1,9 @@ +[Unit] +Description=Change prio + +[Service] +ExecStart=/bin/true +CPUSchedulingPolicy=rr +CPUSchedulingPriority=1 +CPUSchedulingPriority=2 +CPUSchedulingPriority=99 diff --git a/test/sched_rr_ok.service b/test/sched_rr_ok.service new file mode 100644 index 0000000000..b88adc5434 --- /dev/null +++ b/test/sched_rr_ok.service @@ -0,0 +1,6 @@ +[Unit] +Description=Default prio for RR + +[Service] +ExecStart=/bin/true +CPUSchedulingPolicy=rr |