It's not the only thing I did. See the rest of the thread and yes, it works. The example in the post is my first 'what-if' thought, remember. My first solution was to run a php-fpm for each user with their pid placed in the cgroup using the systemd start.
I've made a '
[email protected]' (Notice the @) to create dynamic php-fpm pools per user and use an ExecStartPost to run a shellscript to create a name based user.slice with mkdir /sys/fs/cgroup/user.slice/${USERNAME}, then use a a few:
echo "${VAL}" > /sys/fs/cgroup/user.slice/$USERNAME/cpu.max
echo "${MBYTES}" > /sys/fs/cgroup/user.slice/$USERNAME/memory.max
echo "${MTASKS}" > /sys/fs/cgroup/user.slice/$USERNAME/pids.max
echo "253:0 wbps=${WBYTES} rbps=${RBYTES}" > /sys/fs/cgroup/user.slice/$USERNAME/io.max
echo "${PID}" >> /sys/fs/cgroup/user.slice/$USERNAME/cgroup.procs
to set the limits.
Modifying a user/reseller will simply use a hook to create a new user slice config in /etc/systemd/system/ and run a few systemctl set-property commands to activate the new limits.
My main issue was the persistant php-fpm pool for each user. That was a bit overkill and that's why I started looking for the fpm_children.c patch.