From: "H. Peter Anvin" <hpa@zytor.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: David Fries <david@fries.net>,
tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] system timer: fix crash in <100Hz system timer
Date: Mon, 07 Jan 2008 15:51:09 -0800 [thread overview]
Message-ID: <4782BAED.7060102@zytor.com> (raw)
In-Reply-To: <20080107153650.0cb85eeb.akpm@linux-foundation.org>
Andrew Morton wrote:
>>
>> diff --git a/include/linux/acct.h b/include/linux/acct.h
>> index 302eb72..86b848d 100644
>> --- a/include/linux/acct.h
>> +++ b/include/linux/acct.h
>> @@ -173,7 +173,11 @@ typedef struct acct acct_t;
>> static inline u32 jiffies_to_AHZ(unsigned long x)
>> {
>> #if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0
>> - return x / (HZ / AHZ);
>> + #if HZ < AHZ
>> + return x * (AHZ / HZ);
>> + #else
>> + return x / (HZ / AHZ);
>> + #endif
>> #else
>> u64 tmp = (u64)x * TICK_NSEC;
>> do_div(tmp, (NSEC_PER_SEC / AHZ));
>> diff --git a/kernel/time.c b/kernel/time.c
>> index 09d3c45..23af26f 100644
>> --- a/kernel/time.c
>> +++ b/kernel/time.c
>> @@ -565,7 +565,11 @@ EXPORT_SYMBOL(jiffies_to_timeval);
>> clock_t jiffies_to_clock_t(long x)
>> {
>> #if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
>> + #if HZ < USER_HZ
>> + return x * (USER_HZ / HZ);
>> + #else
>> return x / (HZ / USER_HZ);
>> + #endif
>> #else
>> u64 tmp = (u64)x * TICK_NSEC;
>> do_div(tmp, (NSEC_PER_SEC / USER_HZ));
>> @@ -598,7 +602,12 @@ EXPORT_SYMBOL(clock_t_to_jiffies);
>> u64 jiffies_64_to_clock_t(u64 x)
>> {
>> #if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
>> - do_div(x, HZ / USER_HZ);
>> + #if HZ < USER_HZ
>> + x *= USER_HZ;
>> + do_div(x, HZ);
>> + #else
>> + do_div(x, HZ / USER_HZ);
>> + #endif
>> #else
>> /*
>> * There are better ways that don't overflow early,
>
> Alas, I get 100% rejects due to conflicting changes from Peter's
> avoid-overflows-in-kernel-timec.patch.
>
> Peter, did that patch propagate this failure, or might it have happily
> fixed it?
>
My patch doesn't touch any of these functions, nor touches any code
within 70 lines of this patch -- the last line touched is line 478 --
and doesn't touch linux/acct.h at all, so how could it cause a conflict?
But no, it doesn't fix this particular problem, even if using a similar
technique might very well be a better way to do this kind of conversion.
-hpa
next prev parent reply other threads:[~2008-01-07 23:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-05 22:16 [PATCH] system timer: fix crash in <100Hz system timer David Fries
2008-01-07 23:36 ` Andrew Morton
2008-01-07 23:51 ` H. Peter Anvin [this message]
2008-01-08 0:09 ` Andrew Morton
2008-01-09 7:15 ` Andrew Morton
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=4782BAED.7060102@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=david@fries.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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