ionice idle is ignored [duplicate]

I have been testing the ionice command for a while and the idle (3) mode seems to be ignored in most cases.

My test is to run both command at the same time:

  • du <big folder>
  • ionice -c 3 du <another big folder>

If I check both process in iotop I see no difference in the percentage of io utilization for each process.

To provide more information about the CFQ scheduler I'm using a 3.5.0 linux kernel.

I started doing this test because I'm experimenting a system lag each time a daily cron job updatedb.mlocate is executed in my Ubuntu 12.10 machine.

If you check the /etc/cron.daily/mlocate file you realize that the command is executed like:

/usr/bin/ionice -c3 /usr/bin/updatedb.mlocate

Also, the funny thing is that whenever my system for some reason starts using swap memory, the updatedb.mlocate io process is been scheduled faster than kswapd0 process, and then my system gets stuck.

Some suggestion?

References:

  • http://ubuntuforums.org/showthread.php?t=1243951&page=2
  • https://bugs.launchpad.net/ubuntu/+source/findutils/+bug/332790

Solution 1:

ionice only works if you're using the CFQ kernel scheduler. Distributions seem to default to deadline scheduler.

Look at /sys/block/xvdh/queue/scheduler to see which you have enabled. It is the one in square brackets.