After running
ionice -c2 -n7 <PID> on an I/O-intensive process (VirtualBox VM) and checking the result with ionice -p <PID> it shows best-effort: prio 7 which is expected.

But when monitoring the overall disk I/O of all processes via iotop it shows in PRIO column a value of be/4 for that process, which I assume means best-effort and level (priority) 4, which is average priority and not expected.

Can somebody comment why there's a difference between what ionice and what iotop displays? And is there another way to verify the actual I/O priority of a given process other then with ionice -p ?

From what I understood, there's /proc/<pid>/io but it only displays bytes/characters read and written, but not the priority, cf. Know which process does I/O without iotop
Also How do I view the IO priority of a process? only lists ionice -p

For completeness sake, this is on RHEL 6.7 with iotop 0.3.2, and the scheduler is the default CFQ.


Seems I already found part of the answer. By default iotop shows all processes and threads, and I usually run it via iotop -o which only shows threads and processes doing I/O. The VirtualBox process shown as be/4 is actually a thread, and when I run iotop -p <pid> against the PID which I changed via ionice then it correctly displays be/7 which is expected.

Would still be interesting to know why one thread of that process has a different I/O class/priority, but my ionice does not have -P option to change the I/O class/priority of a process group. Would be nice if someone knows a workaround/solution for that.

  • 1
    "ionice does not have option to change process group. Would be nice if someone knows a workaround/solution for that." Use ionice -p id1 id2 id3 ...
    – Codebling
    Mar 3 '20 at 23:25
  • It was for Chrome in my case, I had to collect the PIDs using ps
    – Codebling
    Mar 3 '20 at 23:31
  • I still wasn't able to change the io prority for threads, only for processes
    – Codebling
    Mar 4 '20 at 0:15
  • @Codebling FWIW, the essential part in your quote was "my ionice" ... seems this was added back in 2014 according to util-linux changelog, hence -P probably wasn't available in RHEL 6.x - just adding for completeness sake
    – doktor5000
    Mar 5 '20 at 17:19
  • I saw and grokked that. I was suggesting an alternative, the use of lowercase -p with a list of PIDs grepped from ps instead of uppercase -P with a PGID. Even with my ionice which supports -P, PGID is not readily available information so it seems easier to always use a list of PIDs. Just through I'd mention it for posterity.
    – Codebling
    Mar 5 '20 at 18:51

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.