Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Is there an easy way to change the I/O priority of a whole group of processes the way renice -g does? It seems like only changing the I/O priority of a single process is supported by ionice. If this can't be done, can someone please point me to the the relevant API calls (I'm not at all familiar with the POSIX api) so that I can write a quick command line utility to implement this functionality myself?

share|improve this question

2 Answers 2

You can make a script called gionice, like that:

#!/bin/sh
ps -s $1 -o pid | xargs ionice -c 2 -n 0 -p 

Then, you can call it like that, for process group id 3266, for example:

./gionice 3266

"ps -s PID -o pid" prints line-by-line identifiers of processes whose group leader is PID. Then, for every line, xargs appends that line after "ionice -c 2 -n 0 -p " and calls the resulting command.

Hope that helps.

share|improve this answer

Have you looked at cgroups and the blkio module?

http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt

You can use it to limit IO with a lot more control then ionice alone. You can also use the cgrulesengd daemon to automatically add new processes to your existing group infrastructure.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.