Re: [Patch for review] BSD accounting IO stats

From: Andi Kleen
Date: Mon Aug 02 2004 - 07:46:37 EST


Guillaume Thouvenin <guillaume.thouvenin@xxxxxxxx> writes:

> diff -uprN -X dontdiff linux-2.6.8-rc2/drivers/block/ll_rw_blk.c linux-2.6.8-rc2+BSDacct_IO/drivers/block/ll_rw_blk.c
> --- linux-2.6.8-rc2/drivers/block/ll_rw_blk.c 2004-07-18 06:57:42.000000000 +0200
> +++ linux-2.6.8-rc2+BSDacct_IO/drivers/block/ll_rw_blk.c 2004-07-27 09:17:33.149321480 +0200
> @@ -1949,10 +1949,12 @@ void drive_stat_acct(struct request *rq,
>
> if (rw == READ) {
> disk_stat_add(rq->rq_disk, read_sectors, nr_sectors);
> + current->rblk += nr_sectors;

This doesn't look very useful, because most writes which
are flushed delayed would get accounted to pdflushd.
Using such inaccurate data for accounting sounds quite dangerous
to me.

If you really wanted to do this i guess you would need to
track the pid of the process and account it there. But the
process may be already gone, so it would better fit into
some other longer lived data structure (like the uid)

Overall I don't think this accounting is worth it because
doing it right would be quite some overhead and doing it in
a simple way like this patch is too inaccurate.

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/