[systemd-devel] RFC: Setting TasksMax= by default

Lennart Poettering lennart at poettering.net
Fri Nov 13 08:04:23 PST 2015


On Fri, 13.11.15 15:36, Jóhann B. Guðmundsson (johannbg at gmail.com) wrote:

> Arguably this should be called system instead of default for system wide
> settings where applicable ( you need to keep a clear distinction which
> option belongs where and what it affects )

The DefaultTasksMax= value in /etc/systemd/system.conf sets the
default limit for units in the --system instance of systemd (i.e. PID
1). The same value in /etc/systemd/user.conf sets the default limit
for units in the --user instance. It's pretty symmetric there.

> Will people be able to disable this per type unit (  set
> "UnitTasksAccounting=yes/no" )

systemd (PID 1) manages units, as such I think it's obvious that a
"default" setting sets the default for those units. And if it's not
clear I think the man page is good enough.

> Users sets SystemTasksAccounting=yes in system.conf but turns off task
> accounting for b.service while while keeping it for every other type
> unit ?

I cannot parse this.

> 
> Or
> 
> Users sets SystemTasksAccounting=no in system.conf but enables task
> accounting for a.service while while keeping it disabled for every other
> type unit ?

I cannot parse this either.

Note that in the individual services you can use TasksMax= already,
but it defaults to "infinity" right now, and I want to make this
global default configurable, that's all.

> >b) I'd like to introduce DefaultTasksMax= that controls the default
> >    value of the per-unit TasksMax= by default, and would like it to
> >    set to some value such 1024 out-of-the-box. This will mean that any
> >    service or scope created will by default be limited to 1024
> >    tasks. This of course is a change from before that has the
> >    potential to break some daemons that maintain an excessive number
> >    of processes or threads. However, I think it's a much better choice
> >    to raise the limit for them, rather than stay unlimited for all
> >    services by default. I think 1024 is not particularly low, but also
> >    not particularly high. Note that the kernel by default limits the
> >    number of processes to 32K in total anyway.
> 
> Should there not be two options "SystemTasksMax" which alters the kernel
> default limits and UnitTaskMax  which controls the default value of per-unit
> ?

I cannot parse this.

> >c) In logind.conf I intend to add a TasksMax= setting that sets the
> >    number of tasks for user sessions, and overrides the systemd-wide
> >    setting for user scopes. It would also be set out-of-the-box, and
> >    default to something like 8K or so. (Note that this is very similar
> >    to setting RLIMIT_NPROC via /etc/security/limits.conf, but has the
> >    benefit of covering also suid binaries, being nicely queriable
> >    via systemctl status and controllable during runtime via "systemctl
> >    set-property" and so on)
> 
> Should not this be SessionTasksMax= setting? to clearly disquince this from
> other task mask settings ( accommodated by SessionTasksAccounting= )

It's in the logind.conf configuration file in the [Login] section. I
think this makes pretty sure that this is about logins...

> # Enable/disable system wide task accounting
> SystemTasksAccounting=yes/no
> 
> # Set system wide task limit
> SystemTasksMax=32768
> 
> # Enables/disable task accounting for type units
> UnitTasksAccounting=yes/no
> 
> # Set type unit wide task limit
> UnitTaskMax=1024

I don't understand what this is supposed to be. Note that every
process systemd manages is within the "-.slice", hence if you want to
account and limit the number of processs on the entire system you can
do so by altering the settings on that slice unit.

> # Enable/disable session task accounting
> SessionTasksAccounting=yes/no
> 
> # Set session task limit
> SessionTasksMax=8000

systemd itself knows nothing about a "session" concept. That's a
logind thing, and as such the settinsg for it have to be in
logind.conf.

> For type units people could overwrite system wide defaults via
> 
> [Unit]
> UnitTasksAccounting=yes/no
> UnitTaskMax=64
> 
> For sessions people could overwrite system wide defaults ( logind.conf ) via
> SessionTasksAccounting=yes/no
> SessionTasksMax=12000
> 
> Status needs to show the current usage and max available and daemon reload
> should issue a warning on or fail if the max value for type units and
> sessions is set higher than the value of system tasks Max

"systemctl status" shows the current usage and any enforced limit
already.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list