February 7, 2006
For quite a while Jens Axboe’s cfq scheduler has supported io priorities for processes. I have been meaning to look at it for a while but never got round to it. Recently the io priorities support made it into mainline so I decided it was time to have a play.
I have only done some basic tests so far, but I am impressed. Processes set to “idle” really do stop dead in their tracks when any “normal” processes want the disk.
One thing that I found odd though was that normal users cannot reduce the priority of their processes to “idle.” That requires root authority. I even got to the point of changing it and asking Jens why it didn’t allow that. Of course it turns out there is a good reason and the code actually used to allow it but was changed to prevent possible DoS attacks.
I think the idea is that a user can use a idle process to lock resources that a high priority process wants but then run a normal priority process doing lots of io which means the idle one (and therefore the high priority one) will never run. In other words it needs to do priority inversion before my patch could go in. Which means work in the fs layer as well as the block layer.
Still, even without altering the io class, the user can change their io timeslice which is useful in itself.