public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jay Lan <jlan@engr.sgi.com>
Cc: linux-kernel@vger.kernel.org, nagar@watson.ibm.com,
	balbir@in.ibm.com, jes@sgi.com, csturtiv@sgi.com, tee@sgi.com,
	guillaume.thouvenin@bull.net
Subject: Re: [patch 3/3] convert CONFIG tag for extended accounting routines
Date: Thu, 3 Aug 2006 00:03:31 -0700	[thread overview]
Message-ID: <20060803000331.22fcb4c0.akpm@osdl.org> (raw)
In-Reply-To: <44D17A47.4010302@engr.sgi.com>

On Wed, 02 Aug 2006 21:23:35 -0700
Jay Lan <jlan@engr.sgi.com> wrote:

> +/**
> + * acct_update_integrals - update mm integral fields in task_struct
> + * @tsk: task_struct for accounting
> + */
> +void acct_update_integrals(struct task_struct *tsk)
> +{
> +	if (likely(tsk->mm)) {
> +		long delta =
> +			cputime_to_jiffies(tsk->stime) - tsk->acct_stimexpd;

If a 32 architecture chooses to implement a 64-bit cputime_t, this
expression might go wrong for very long-running tasks and high HZ.

Perhaps we should do all this in terms of cputime_t and export everything
to userspace as u64?

> +		if (delta == 0)
> +			return;
> +		tsk->acct_stimexpd = tsk->stime;
> +		tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm);
> +		tsk->acct_vm_mem1 += delta * tsk->mm->total_vm;

It's a bit weird to be multiplying RSS by time.  What unit is a "byte
second"?

If this is not a bug then I guess this is an intermediate term for
additional downstream processing.  There is information loss here and I'd
have thought that it would be better to simply send `delta' and the rss
straight to userspace, let userspace work out what math it wants to perform
on it.  If that makes sense?

I see that the code has been like this for a long time, so treat this as a
"please educate me about BSD accounting" email ;)


  reply	other threads:[~2006-08-03  7:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-03  4:23 [patch 3/3] convert CONFIG tag for extended accounting routines Jay Lan
2006-08-03  7:03 ` Andrew Morton [this message]
2006-08-03 21:15   ` Jay Lan
2006-08-08  1:49     ` Jay Lan

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=20060803000331.22fcb4c0.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=balbir@in.ibm.com \
    --cc=csturtiv@sgi.com \
    --cc=guillaume.thouvenin@bull.net \
    --cc=jes@sgi.com \
    --cc=jlan@engr.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox