From: Lev Makhlis <mlev@despammed.com>
To: "Randy.Dunlap" <rddunlap@osdl.org>
Cc: <ricklind@us.ibm.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH] sard changes for 2.5.34
Date: Wed, 18 Sep 2002 15:43:09 -0400 [thread overview]
Message-ID: <200209181543.09111.mlev@despammed.com> (raw)
In-Reply-To: <Pine.LNX.4.33L2.0209181052360.19972-100000@dragon.pdx.osdl.net>
On Wednesday 18 September 2002 01:54 pm, Randy.Dunlap wrote:
> On Sat, 14 Sep 2002, Lev Makhlis wrote:
> | > +#define MSEC(x) ((x) * 1000 / HZ)
> |
> | Perhaps it would be better to report the times in ticks using
> | jiffies_to_clock_t(), and let the userland do further conversions?
> | The macro above has an overflow problem, it creates a counter
> | that wraps at 2^32 / HZ (instead of 2^32), and theoretically, the
> | userland doesn't even know what the internal HZ is. The overflow
> | can be avoided with something like
> | #define MSEC(x) (((x) / HZ) * 1000 + ((x) % HZ) * 1000 / HZ)
> | but I think it would be cleaner just to change the units to ticks,
> | especially if we're moving it to a different file and procps will
> | need to be changed anyway.
>
> Thanks for pointing this out.
>
> I'd rather not expose more ticks in /proc, so for now
> I'll ask Rick to use this #define for MSEC, which does
> indeed work nicely.
In that case, I also suggest manual optimization for "convenient"
values of HZ, because from what I've seen, GCC can't figure this
out on its own:
#if 1000 % HZ == 0
#define MSEC(x) ((x) * (1000 / HZ))
#elif HZ % 1000 == 0
#define MSEC(x) ((x) / (HZ / 1000))
#else
#define MSEC(x) (((x) / HZ) * 1000 + ((x) % HZ) * 1000 / HZ)
#endif
next prev parent reply other threads:[~2002-09-18 19:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-14 18:57 [RFC][PATCH] sard changes for 2.5.34 Lev Makhlis
2002-09-18 17:54 ` Randy.Dunlap
2002-09-18 19:43 ` Lev Makhlis [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-09-13 11:39 Dipankar Sarma
2002-09-12 2:10 Rick Lindsley
2002-09-12 2:42 ` Andrew Morton
2002-09-12 2:50 ` Rik van Riel
2002-09-12 6:40 ` Rick Lindsley
2002-09-12 7:20 ` Andrew Morton
2002-09-12 9:18 ` Rick Lindsley
2002-09-12 10:01 ` Alexander Viro
2002-09-12 10:33 ` Rick Lindsley
2002-09-12 19:42 ` Andrew Morton
2002-09-12 20:38 ` Rik van Riel
2002-09-12 16:16 ` Rik van Riel
2002-09-12 16:48 ` Andrew Morton
2002-09-12 23:32 ` Denis Vlasenko
2002-09-12 18:49 ` Andrew Morton
2002-09-12 19:50 ` Rick Lindsley
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=200209181543.09111.mlev@despammed.com \
--to=mlev@despammed.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rddunlap@osdl.org \
--cc=ricklind@us.ibm.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