[systemd-devel] set rr scheduler failed with cpushares

WaLyong Cho walyong.cho at samsung.com
Mon Nov 17 06:46:46 PST 2014


Hello,

I'd made two different services. One has *CPUSchedulingPolicy=rr* and
the others has *CPUShares=*.

# cat foo.service
[Unit]
Description=foo has CPUSchedulingPolicy=

[Service]
RemainAfterExit=yes
ExecStart=/bin/true
CPUSchedulingPolicy=rr

# cat bar.service
[Unit]
Description=bar has CPUShares=

[Service]
RemainAfterExit=yes
ExecStart=/usr/bin/hello.sh
CPUShares=100

foo.service is activated well if bar.service is not activated.


# systemctl start foo.service; systemctl status foo.service bar.service
foo.service - foo has CPUSchedulingPolicy=
   Loaded: loaded (/usr/lib/systemd/system/foo.service; static)
   Active: active (exited) since Mon 2014-11-17 23:32:44 KST; 5s ago
  Process: 2702 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 2702 (code=exited, status=0/SUCCESS)


bar.service - bar has CPUShares=
   Loaded: loaded (/usr/lib/systemd/system/bar.service; static)
   Active: inactive (dead)

But if bar.service(what has CPUShares=) then foo.service failed on
sched_setscheduler(). EPERM was returned.

# systemctl start bar.service; systemctl restart foo.service; systemctl
status foo.service bar.service
foo.service - foo has CPUSchedulingPolicy=
   Loaded: loaded (/usr/lib/systemd/system/foo.service; static)
   Active: active (exited) (Result: exit-code) since Mon 2014-11-17
23:34:48 KST; 75ms ago
  Process: 3222 ExecStart=/bin/true (code=exited, status=214/SETSCHEDULER)
 Main PID: 3222 (code=exited, status=214/SETSCHEDULER)

Nov 17 23:34:48 KIRAN systemd[1]: Started foo has CPUSchedulingPolicy=.
Nov 17 23:34:48 KIRAN systemd[1]: foo.service: main process exited,
code=ex...ER

bar.service - bar has CPUShares=
   Loaded: loaded (/usr/lib/systemd/system/bar.service; static)
   Active: active (running) since Mon 2014-11-17 23:34:48 KST; 296ms ago
 Main PID: 3218 (hello.sh)
   CGroup: /system.slice/bar.service
           ├─3218 /bin/bash /usr/bin/hello.sh
           └─3221 sleep 1

Could anyone help me?

Thanks,
WaLyong


More information about the systemd-devel mailing list