3

I need to set the default CPU affinity for all the daemons managed by systemd, except a specific service.

Setting service's CPU affinity at /etc/systemd/system/myname.service.d/scheduler.conf works just fine, so I guessed I could set my service affinity to, say, cores 2-11, and let the rest of the system to live with cores 0-1.

It seems I can't.

I tried /etc/systemd/system.conf.d/default.conf and even changed /etc/systemd/system.conf.

All the daemons (except my one) still start with all the CPUs allowed.

It seems too much hassle to setup an override /etc/systemd/system/*.service.d configuration file for each other system service.

The systemd version is 215 (from Debian Jessie)

Update: I revisited /etc/systemd/system.conf and found that I misspelled the CPU cores list. I experimented a bit more and found that, although I can setup default CPU Affinity in /etc/systemd/system.conf, the setting in /etc/systemd/system.conf.d/ doesn't seem to have any effect.

I would prefer to keep this setting in /etc/systemd/system.conf.d/scheduler.conf as the whole fleet is managed by ansible. I found a couple of examples at github with the section ([Manager]) line absent, but this doesn't work for me, too. Documentation clearly mention /etc/systemd/system.conf.d. What do I miss?

  • I don't have a way to test this, but did you check CPUAffinity parameter in /etc/systemd/system.conf, that should configure default cpuaffinity for init process and thus all other daemons – VenkatC Nov 17 '15 at 14:17
  • Well, I tried it first by misspeeled the CPU list. This does solve the issue indeed but it's a bit inconvenient as all the servers are managed by ansible and placing configuration file into system.conf.d is much better that changing system default file – Alexey Naidyonov Nov 17 '15 at 14:47
2

Ok, apparently the v215 from Jessie doesn't support /etc/systemd/system.conf.d at all (see src/core/main.c:parse_config_file).

Pity.

The case is closed, though.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.