public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
To: linux-ia64@vger.kernel.org
Subject: Re: [PATCH 3/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting)
Date: Tue, 30 Oct 2007 02:25:55 +0000	[thread overview]
Message-ID: <47269633.8050409@jp.fujitsu.com> (raw)
In-Reply-To: <4714BE38.60807@jp.fujitsu.com>

Simon Horman wrote:
> On Tue, Oct 16, 2007 at 10:35:52PM +0900, Hidetoshi Seto wrote:
>> +#define cputime_to_jiffies(__ct)	((__ct) * HZ / NSEC_PER_SEC)
>> +#define jiffies_to_cputime(__jif)	((__jif) * NSEC_PER_SEC / HZ)
>> +#define cputime64_to_jiffies64(__ct)	((__ct) * HZ / NSEC_PER_SEC)
>> +#define jiffies64_to_cputime64(__jif)	((__jif) * NSEC_PER_SEC / HZ)
> 
> It looks like cputime64_to_jiffies64 and cputime_to_jiffies will
> overflow at (((2^64 -1) / HZ) + 1) ns. In the case where HZ is 1000,
> this means it will overflow at (584/1000) years or about 213 days.
> Similarly for cputime_to_clock_t(). Is this a problem?

Exactly.
I guess NSEC_PER_SEC is permanently 10^9, and larger HZ will not be
required soon in this century. Does the following help us?

#define cputime64_to_jiffies64(__ct)	((__ct) / (NSEC_PER_SEC / HZ))
#define jiffies64_to_cputime64(__jif)	((__jif) * (NSEC_PER_SEC / HZ))

Thanks,
H.Seto

  parent reply	other threads:[~2007-10-30  2:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-16 13:35 [PATCH 3/9] ia64: VIRT_CPU_ACCOUNTING (accurate cpu time accounting) Hidetoshi Seto
2007-10-30  1:40 ` Simon Horman
2007-10-30  2:25 ` Hidetoshi Seto [this message]
2007-10-30  2:41 ` Simon Horman

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=47269633.8050409@jp.fujitsu.com \
    --to=seto.hidetoshi@jp.fujitsu.com \
    --cc=linux-ia64@vger.kernel.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