mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Andrea Righi <righi.andrea@gmail.com>
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	balbir@linux.vnet.ibm.com, matt@bluehost.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] task IO accounting: improve code readability
Date: Sun, 27 Jul 2008 20:33:23 +0400	[thread overview]
Message-ID: <20080727163323.GA1802@tv-sign.ru> (raw)
In-Reply-To: <1217172555-8335-1-git-send-email-righi.andrea@gmail.com>

On 07/27, Andrea Righi wrote:
>
> Put all i/o statistics in struct proc_io_accounting and use inline functions to
> initialize and increment statistics, removing a lot of single variable
> assignments.

Imho, the change like this is obviously good, but can't we simplify
this a little bit? Just make

	struct task_io_accounting
	{
	#ifdef CONFIG_TASK_XACCT
		/* bytes read */
		u64 rchar;
		/*  bytes written */
		u64 wchar;
		/* # of read syscalls */
		u64 syscr;
		/* # of write syscalls */
		u64 syscw;
	#endif /* CONFIG_TASK_XACCT */

	#ifdef CONFIG_TASK_IO_ACCOUNTING
		/*
		 * The number of bytes which this task has caused to be read from
		 * storage.
		 */
		u64 read_bytes;

		/*
		 * The number of bytes which this task has caused, or shall cause to be
		 * written to disk.
		 */
		u64 write_bytes;

		/*
		 * A task can cause "negative" IO too.  If this task truncates some
		 * dirty pagecache, some IO which another task has been accounted for
		 * (in its write_bytes) will not be happening.  We _could_ just
		 * subtract that from the truncating task's write_bytes, but there is
		 * information loss in doing that.
		 */
		u64 cancelled_write_bytes;
	#endif
	};

This should make the patch much smaller with the same effect, no?

Oleg.


  reply	other threads:[~2008-07-27 16:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-27 15:29 Andrea Righi
2008-07-27 16:33 ` Oleg Nesterov [this message]
2008-07-27 21:53   ` Andrea Righi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080727163323.GA1802@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@bluehost.com \
    --cc=righi.andrea@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®