[systemd-devel] [PATCH] Add the CPU hotplug rule

Colin Guthrie gmane at colin.guthr.ie
Tue Sep 2 08:11:37 PDT 2014


John Haxby wrote on 02/09/14 10:31:
> Col, forgive my ignorance, but cpuadd@$name.service seems to imply that
> you'd have one file or symlink per CPU.  That's going to be unwieldy
> when you have hundreds of CPUs isn't it?

Not quite. systemd units with an @ in them are a bit special. You have
one unit file on disk (cpuadd at .service) and you can instantiate
instances of them via cpuadd at xxx.service where the value xxx is
available inside the unit and can be passed to scripts or binaries in
the ExecStart lines via the %i and %I modifiers.

In this case you wouldn't ever enable them individually via explicit
symlinks (which is valid in some use cases) but udev would defer to
systemd to start the instance as needed. This is very similar to how the
built in systemd-rfkill at .service works. See
/usr/lib/systemd/system/systemd-rfkill at .service. It's instantiated as
systemd-rfkill at rfkill1.service for example.


It's basically the way to pass in the the CPU number or name to the
service so you can implement that mission critical "only allowing prime
numbered CPUs on Wednesday" policy ;)

Col

-- 

Colin Guthrie
  http://colin.guthr.ie/



More information about the systemd-devel mailing list