* [PATCH] Real-Time Preemption, using msecs_to_jiffies() instead of HZ
@ 2005-06-10 16:42 Luca Falavigna
2005-06-11 13:32 ` Ingo Molnar
0 siblings, 1 reply; 3+ messages in thread
From: Luca Falavigna @ 2005-06-10 16:42 UTC (permalink / raw)
To: mingo; +Cc: Linux Kernel Mailing List
Hi,
I was looking at kernel/softlookup.c when I noticed you used HZ in order to get
a 10-second delay:
void softlockup_tick(struct pt_regs *regs)
{
...
if (time_after(jiffies, timestamp + 10*HZ)) {
...
}
I created this small patch (built against version 2.6.12-rc6-V0.7.48-05) which
does use of msecs_to_jiffies() to get a correct behaviour with every platform.
Similarly I modified function watchdog and kernel/irq/autoprobe.c file
(probe_irq_on function).
Here is the patch:
--- ./rtp-2.6.12-rc6-V0.7.48-05.orig 2005-06-10 16:27:48.000000000 +0000
+++ ./rtp-2.6.12-rc6-V0.7.48-05 2005-06-10 16:30:18.000000000 +0000
@@ -7425,7 +7425,7 @@
+ /*
+ * Wait for longstanding interrupts to trigger, 20 msec delay:
+ */
-+ msleep(HZ/50);
++ msleep(msecs_to_jiffies(20));
/*
* enable any unassigned irqs
@@ -7452,7 +7452,7 @@
*/
- for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
- /* about 100ms delay */ barrier();
-+ msleep(HZ/10);
++ msleep(msecs_to_jiffies(100));
/*
* Now filter out any obviously spurious interrupts
@@ -10712,7 +10712,7 @@
+ if (did_panic)
+ return;
+
-+ if (time_after(jiffies, timestamp + 10*HZ)) {
++ if (time_after(jiffies, timestamp + msecs_to_jiffies(10000))) {
+ per_cpu(print_timestamp, this_cpu) = timestamp;
+
+ spin_lock(&print_lock);
@@ -10748,7 +10748,7 @@
+ */
+ while (!kthread_should_stop()) {
+ set_current_state(TASK_INTERRUPTIBLE);
-+ msleep_interruptible(HZ);
++ msleep_interruptible(msecs_to_jiffies(1000));
+ touch_softlockup_watchdog();
+ }
+ __set_current_state(TASK_RUNNING);
Regards,
--
Luca
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Real-Time Preemption, using msecs_to_jiffies() instead of HZ
2005-06-10 16:42 [PATCH] Real-Time Preemption, using msecs_to_jiffies() instead of HZ Luca Falavigna
@ 2005-06-11 13:32 ` Ingo Molnar
2005-06-13 2:10 ` Luca Falavigna
0 siblings, 1 reply; 3+ messages in thread
From: Ingo Molnar @ 2005-06-11 13:32 UTC (permalink / raw)
To: Luca Falavigna; +Cc: Linux Kernel Mailing List
* Luca Falavigna <dktrkranz@gmail.com> wrote:
> I was looking at kernel/softlookup.c when I noticed you used HZ in order to get
> a 10-second delay:
>
> void softlockup_tick(struct pt_regs *regs)
> {
> ...
> if (time_after(jiffies, timestamp + 10*HZ)) {
> ...
> }
oops, indeed. (i've also forwarded your patch to akpm, as the softlockup
patch is included in -mm too)
> I created this small patch (built against version
> 2.6.12-rc6-V0.7.48-05) which does use of msecs_to_jiffies() to get a
> correct behaviour with every platform. Similarly I modified function
> watchdog and kernel/irq/autoprobe.c file (probe_irq_on function).
>
> Here is the patch:
> ++ msleep(msecs_to_jiffies(20));
> ++ msleep(msecs_to_jiffies(100));
> ++ msleep_interruptible(msecs_to_jiffies(1000));
actually, this should be msleep(20/100/1000). I've fixed these in my
tree.
Ingo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Real-Time Preemption, using msecs_to_jiffies() instead of HZ
2005-06-11 13:32 ` Ingo Molnar
@ 2005-06-13 2:10 ` Luca Falavigna
0 siblings, 0 replies; 3+ messages in thread
From: Luca Falavigna @ 2005-06-13 2:10 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Linux Kernel Mailing List
Ingo Molnar ha scritto:
> oops, indeed. (i've also forwarded your patch to akpm, as the softlockup
> patch is included in -mm too)
OK, thank you!
I also found another couple of those in drivers/char/rtc.c file.
Here is a quick fix:
--- ./rtp-2.6.12-rc6-V0.7.48-17.orig 2005-06-13 01:26:53.000000000 +0000
+++ ./rtp-2.6.12-rc6-V0.7.48-17 2005-06-13 01:58:13.000000000 +0000
@@ -17044,7 +17044,7 @@
- barrier();
- cpu_relax();
- }
-+ msleep(2*HZ/100);
++ msleep(20);
spin_lock_irq(&rtc_lock);
year = CMOS_READ(RTC_YEAR);
@@ -17102,7 +17102,7 @@
- barrier();
- cpu_relax();
- }
-+ msleep(2*HZ/100);
++ msleep(20);
/*
* Only the values that we read from the RTC are set. We leave
Regards,
--
Luca
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-06-13 16:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-10 16:42 [PATCH] Real-Time Preemption, using msecs_to_jiffies() instead of HZ Luca Falavigna
2005-06-11 13:32 ` Ingo Molnar
2005-06-13 2:10 ` Luca Falavigna
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox