[systemd-devel] FW: pthread_create() fails SysV in myDaemon on boot
Lennart Poettering
lennart at poettering.net
Thu Nov 3 15:07:43 PDT 2011
On Thu, 03.11.11 15:37, Michael D. Berger (m.d.berger at ieee.org) wrote:
>
> > -----Original Message-----
> > From: Kay Sievers [mailto:kay.sievers at vrfy.org]
> > Sent: Thursday, November 03, 2011 14:58
> > To: Michael D. Berger
> > Cc: Michal Schmidt; systemd-devel at lists.freedesktop.org
> > Subject: Re: [systemd-devel] FW: pthread_create() fails SysV
> > in myDaemon on boot
> >
> > On Thu, Nov 3, 2011 at 17:41, Michael D. Berger
> > <m.d.berger at ieee.org> wrote:
> >
> > > In the link you provided, I found:
> > > in /etc/systemd/system.conf,
> > > change
> > > #DefaultControllers=cpu
> > > into
> > > DefaultControllers=
> > > That, in fact, got myDaemon to start on boot.
> >
> > I guess, you need to assign a realtime budget in the cpu
> > controller of the service for SCHED_FIFO to work.
> >
> > Kay
> [...]
>
> Can you direct me to instructions on how to do that?
So, you basically have three options here:
a) Opt out of the "cpu" cgroup controller entirely, by dropping it from
DefaultControllers in /etc/systemd/system.conf.
b) Explicitly place your service in the root cgroup of the "cpu"
controller, by adding "ControlGroup=cpu:/" to the service file.
c) By actually assigning an RT budget to the group, by adding
"ControlGroupAttribute=cpu.rt_runtime_us 500000" to the service file.
Background: we place every service on the system in its own cgroup in
the "cpu" hierarchy. Unfortunately this means that processes which do RT
will break, since creating a cgroup in the "cpu" hierarchy will assign
them a zero RT budget by default. This needs to be fixed in the kernel
one day. With option a) you globally disable that your services get
their own "cpu" cgroup. With option b) you do this only for the service
in question. With c) you assign an explicit RT budget.
Why do we add all services to their own "cpu" cgroups? because it evens
out CPU usage of services with many and with few processes. Consider
Apache with a 1000 worker processes and CGI scripts forked off vs. MySQL
with 1 process. Normally, Apache would get 1000 as much CPU as MySQL. By
adding them to their own cgroups Apache will get half and MySQL the
other half of the available CPU time.
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list