You are not logged in.
I open 2 terminals and start following commands:
$ time ffmpeg -y -f lavfi -i "colorspectrum=duration=60:size=1280x720:rate=30" /tmp/file01.mp4
$ time -p systemd-run --user --pty --quiet -d -p IOWeight=10 -p CPUWeight=idle -p CPUSchedulingPolicy=idle ffmpeg -y -f lavfi -i colorspectrum=duration=60:size=1280x720:rate=30 /tmp/file02.mp4
$ ps ax --format tty,cmd,cls,ni,pri,rtprio |grep ffmpeg
pts/0 ffmpeg -y -f lavfi -i color TS 0 19 -
pts/3 /usr/bin/ffmpeg -y -f lavfi IDL - 19 0
Both processes still use the same amount of CPU. The same when using 'nice'.
I expect the low priority process doing nothing as long as the normal one is running.
Why is it not happening? How is it done right?
Last edited by Maniaxx (2024-06-08 23:57:47)
sys2064
Offline
You probably need to boot the kernel with the "noautogroup" parameter. Without it tasks are assigned to groups and sheduling is done on those groups and not on the tasks in those groups.
But you won't get the idle task to do nothing. That's not how the default Linux kernel handles those processes. They have a low priority but not down to zero.
Offline
I'm kinda disappointed of systemd-run as highlevel manager that controls all the magic around cgroups and such. The only thing that gives true control is 'systemd-run --user --pty -d -p CPUQuota="200%"' that keeps it down by hardlimit. I don't see why this can't be implemented as an idle/polling mechanism by systemd. Strange world.
Thanks anyway!
sys2064
Offline