lkml.org 
[lkml]   [2002]   [Sep]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] [2.5.35] USER_HZ & NTP problem (II)
Hi!

As said in previous postings I experimented with HZ=2048 (I actually
tried HZ=4096, don't tell anybody), and the following problem emerged:

Suppose
HZ = 2048
and SHIFT_SCALE = 22
and SHIFT_UPDATE = (SHIFT_KG + MAXTC) = 12
then
SHIFT_HZ = 11
and (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE) = -1

This negative number seems te be a problem for shift operations. The
following patch takes care of the problem (I hope).

Rolf

--- linux-2.5.35.orig/kernel/timer.c Mon Sep 16 20:43:47 2002
+++ linux-2.5.35/kernel/timer.c Mon Sep 16 21:01:41 2002
@@ -339,6 +339,11 @@
run_task_queue(&tq_immediate);
}

+static inline long negleftshift (long val, int nshift)
+{
+ return (nshift > 0 ? val << nshift : val >> -nshift);
+}
+
/*
* this routine handles the overflow of the microsecond field
*
@@ -418,7 +423,7 @@
if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;
time_offset += ltemp;
- time_adj = -ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+ time_adj = negleftshift (-ltemp, SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
} else {
ltemp = time_offset;
if (!(time_status & STA_FLL))
@@ -426,7 +431,7 @@
if (ltemp > (MAXPHASE / MINSEC) << SHIFT_UPDATE)
ltemp = (MAXPHASE / MINSEC) << SHIFT_UPDATE;
time_offset -= ltemp;
- time_adj = ltemp << (SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
+ time_adj = negleftshift (ltemp, SHIFT_SCALE - SHIFT_HZ - SHIFT_UPDATE);
}

/*
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.054 / U:3.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site