I have a program that spawns multiple threads, all of which do fairly intensive IO, running on the background. I want to set the scheduling class to idle so that it doesn't clog up the system; however, ionice -c3 -p <PID>, where <PID> is the process ID, does not have the desired effect. Although the scheduling class for process <PID> is changed, when I launched iotop, all the threads it had spawned still had the default priority (best-effort level 4).
How do I change the IO priority of a program and all the threads or processes it has spawned on Linux?