[systemd-devel] CPUAffinity=all ?

Lennart Poettering lennart at poettering.net
Fri Mar 24 10:38:30 UTC 2023


On Do, 23.03.23 16:59, Etienne Champetier (champetier.etienne at gmail.com) wrote:

> Le jeu. 23 mars 2023 à 16:37, Etienne Champetier
> <champetier.etienne at gmail.com> a écrit :
> >
> > Hello,
> >
> > I'm setting `CPUAffinity=0-1` in /etc/systemd/system.conf, this works great.
> > Now, I want one of my units to set CPUAffinity to all available CPUs,
> > without knowing the number of CPUs.
> > Using `CPUAffinity=` reset the setting but we are still inheriting
> > from the parent so I still have `Cpus_allowed_list: 0-1`
> > Is there a way to do that in the latest systemd versions ? (I'm using
> > Alma Linux 8.7 / systemd-239-68.el8_7.4)
>
> Actually `CPUAffinity=0-999` works,
> any plans to make it error out or warn when CPU don't exists ?

We generally have the plan to make systemd units "universal",
i.e. that they always apply to the local system in the best way
possible.

There are some exceptions (exclusively in the security area) where we
do not gracefully accept configuration mismatches, but for things like
resource management (and cpu affinity is part of that) we certainly
have the goal to handle this nicely.

That said, adding CPUAffinity=all would certainly be a useful concept
to have. Consider submitting an issue asking for that on systemd
Github. Or even better, send a patch!

Lennart

--
Lennart Poettering, Berlin


More information about the systemd-devel mailing list