All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Righi <righiandr@users.sourceforge.net>
To: balbir@linux.vnet.ibm.com
Cc: Shailabh Nagar <nagar@watson.ibm.com>,
	Mark Seger <Mark.Seger@hp.com>, Jes Sorensen <jes@sgi.com>,
	Chris Sturtivant <csturtiv@sgi.com>, Tony Ernst <tee@sgi.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] distinct tgid/tid I/O statistics
Date: Mon, 19 May 2008 20:33:11 +0200	[thread overview]
Message-ID: <4831C7E7.2090804@users.sourceforge.net> (raw)
In-Reply-To: <4831BDBA.6090609@linux.vnet.ibm.com>

Balbir Singh wrote:
>> +
>> +    if (!whole) {
>> +#ifdef CONFIG_TASK_XACCT
> 
> Can't we abstract this into a function for ease?

Maybe:

#ifdef CONFIG_TASK_XACCT
#define _task_xacct 1
#else
#define _task_xacct 0
#endif

and:

rchar = __task_xacct ? task->rchar : 0;
wchar = __task_xacct ? task->wchar : 0;
syscr = __task_xacct ? task->syscr : 0;
syscw = __task_xacct ? task->syscw : 0;

But it's very ugly anyway. It seems a similar problem has been raised
here:

http://lkml.org/lkml/2008/5/17/154

Apparently with no solution.

> 
>> +        rchar = task->rchar;
>> +        wchar = task->wchar;
>> +        syscr = task->syscr;
>> +        syscw = task->syscw;
>> +#endif
>> +        memcpy(&ioac, &task->ioac, sizeof(ioac));
>> +    } else {
>> +        rchar = wchar = syscr = syscw = 0;
>> +        memset(&ioac, 0, sizeof(ioac));
>> +        rcu_read_lock();
>> +        if (lock_task_sighand(task, &flags)) {
> 
> If lock(), what happens otherwise?
> 

mmmh... we must surely move the threads stats accounting code out of
the if statement. OK, I'll post a new patch soon.

Thanks,
-Andrea

>> +        struct signal_struct *sig = task->signal;
>> +        struct task_struct *t = task;
>> +
>> +            do {
>> +#ifdef CONFIG_TASK_XACCT
>> +                rchar += t->rchar;
>> +                wchar += t->wchar;
>> +                syscr += t->syscr;
>> +                syscw += t->syscw;
>> +#endif
>> +                ioac.read_bytes += t->ioac.read_bytes;
>> +                ioac.write_bytes += t->ioac.write_bytes;
>> +                ioac.cancelled_write_bytes +=
>> +                        t->ioac.cancelled_write_bytes;
>> +                t = next_thread(t);
>> +            } while (t != task);
>> +
>> +#ifdef CONFIG_TASK_XACCT
>> +            rchar += sig->rchar;
>> +            wchar += sig->wchar;
>> +            syscr += sig->syscr;
>> +            syscw += sig->syscw;
>> +#endif
>> +            ioac.read_bytes += sig->ioac.read_bytes;
>> +            ioac.write_bytes += sig->ioac.write_bytes;
>> +            ioac.cancelled_write_bytes +=
>> +                    sig->ioac.cancelled_write_bytes;
>> +
>> +            unlock_task_sighand(task, &flags);
>> +        }
>> +        rcu_read_unlock();
>> +    }

  reply	other threads:[~2008-05-19 18:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-16 20:38 [PATCH] distinct tgid/tid I/O statistics (was: taskstats and /proc/.../io asymmetry?) Andrea Righi
2008-05-19 16:36 ` Andrea Righi
2008-05-19 17:49 ` Balbir Singh
2008-05-19 18:33   ` Andrea Righi [this message]
2008-05-19 20:08     ` [PATCH] distinct tgid/tid I/O statistics Andrea Righi
2008-05-19 21:57       ` [PATCH v2] " 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=4831C7E7.2090804@users.sourceforge.net \
    --to=righiandr@users.sourceforge.net \
    --cc=Mark.Seger@hp.com \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=csturtiv@sgi.com \
    --cc=jes@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nagar@watson.ibm.com \
    --cc=tee@sgi.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.