Wednesday, May 28, 2008

task i/o accounting in Linux: provide distinct tgid/tid i/o statistics

Here a new patch sent to the LKML. This patch (coverage at LWN.net) allows to properly account i/o statistics of threaded applications (tasks spawning threads by clone() syscall + CLONE_THREAD flag).

Without this fix a generic application can bypass of the accounting of the actual i/o statistics creating a bunch of threads doing the real i/o work.

The patch permits to account aggregate i/o statistics in /proc/PID/io, so it allows to easily find the top i/o consumer simply looking at this file, even when PID spawns the i/o worker threads. Moreover, a new file /proc/PID/task/TID/io (one for each TID) is created in procfs to account single thread i/o statistics, allowing in this way, to find which thread(s) of the top i/o consumer is eating the whole i/o bandwidth.

No comments: