From: Tim Schmielau <tim@physik3.uni-rostock.de>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] [PATCH] fix nanosleep() granularity bumps
Date: Tue, 18 Mar 2003 09:05:56 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590709806150@msgid-missing> (raw)
On Mon, 17 Mar 2003, Tim Schmielau wrote:
> I've re-checked that the problem does not occur with the original "initial
> jiffies" patch for 2.4.
Stupid me - 2.4 with the patch has the same problem, it just takes 10x as
long to show up, a range that was not covered by the testcase.
The actual problem is that I didn't fully understand the, well,
'elaborated' way of counting jiffies in the timer cascade:
When starting out with timer_jiffies=0, the timer cascade is
(unneccessarily) triggered on the first timer interrupt, incrementing all
the higher indices.
When starting with any other initial jiffies value, we miss that and end
up with all higher indices being off by one.
Fix is as follows:
--- linux-2.5.65/kernel/timer.c Wed Mar 5 04:29:33 2003
+++ linux-2.5.65-jfix/kernel/timer.c Tue Mar 18 09:40:13 2003
@@ -1183,10 +1183,14 @@
base->timer_jiffies = INITIAL_JIFFIES;
base->tv1.index = INITIAL_JIFFIES & TVR_MASK;
- base->tv2.index = (INITIAL_JIFFIES >> TVR_BITS) & TVN_MASK;
- base->tv3.index = (INITIAL_JIFFIES >> (TVR_BITS+TVN_BITS)) & TVN_MASK;
- base->tv4.index = (INITIAL_JIFFIES >> (TVR_BITS+2*TVN_BITS)) & TVN_MASK;
- base->tv5.index = (INITIAL_JIFFIES >> (TVR_BITS+3*TVN_BITS)) & TVN_MASK;
+ base->tv2.index = ((INITIAL_JIFFIES >> TVR_BITS)
+ + (INITIAL_JIFFIES!=0)) & TVN_MASK;
+ base->tv3.index = ((INITIAL_JIFFIES >> (TVR_BITS+TVN_BITS))
+ + (INITIAL_JIFFIES!=0)) & TVN_MASK;
+ base->tv4.index = ((INITIAL_JIFFIES >> (TVR_BITS+2*TVN_BITS))
+ + (INITIAL_JIFFIES!=0)) & TVN_MASK;
+ base->tv5.index = ((INITIAL_JIFFIES >> (TVR_BITS+3*TVN_BITS))
+ + (INITIAL_JIFFIES!=0)) & TVN_MASK;
}
static int __devinit timer_cpu_notify(struct notifier_block *self,
Sorry for all the trouble,
Tim
reply other threads:[~2003-03-18 9:05 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=marc-linux-ia64-105590709806150@msgid-missing \
--to=tim@physik3.uni-rostock.de \
--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