Re: [patch] jiffies wraparound [Re: 2.1.125 Show stopper list: Draft]

Andi Kleen (ak@muc.de)
20 Oct 1998 12:40:45 +0200


In article <Pine.LNX.3.96.981020060434.28951I-100000@chiara.csoma.elte.hu>,
MOLNAR Ingo <mingo@chiara.csoma.elte.hu> writes:
> On Mon, 19 Oct 1998 ralf@uni-koblenz.de wrote:

>> > I guess it depends on your agenda. An OS that has to be rebooted every
>> > 490 days isnt a very good embedded system large or small. "Please remember
>> > to reboot your building airconditioning control system about next august" ;)
>> >
>> > View from on high noted, want me to take it off the list ?
>>
>> Some people are running kernel at a higher HZ which brings them much closer
>> to the danger zone.

> good point. Especially soft-RT-people like the choice of HZ=1000,
> millisec-accuracy scheduling and timers. I remember someone even used
> 10000, to get 100 usec accuracy timers. Even a low-end PC can take HZ=10k.
> That one wraps jiffies every 4 days!

There is only one problem with it: glibc doesn't know about it and returns
the wrong value to posix conformant programs trying to get it with sysconf().
Solution: add a readonly sysctl for HZ.

diff -u -r1.60 include/linux/sysctl.h
--- include/linux/sysctl.h 1998/05/07 20:48:57 1.60
+++ include/linux/sysctl.h 1998/07/27 14:06:40
@@ -67,7 +67,8 @@
KERN_PPC_HTABRECLAIM, /* turn htab reclaimation on/off on PPC */
KERN_PPC_ZEROPAGED, /* turn idle page zeroing on/off on PPC */
KERN_MODPROBE,
- KERN_SG_BIG_BUFF
+ KERN_SG_BIG_BUFF,
+ KERN_HZ /* int: Readonly: export HZ to userspace */
};


diff -u -r1.45 kernel/sysctl.c
--- kernel/sysctl.c 1998/06/16 04:38:13 1.45
+++ kernel/sysctl.c 1998/07/27 14:06:57
@@ -55,6 +55,8 @@
extern unsigned long htab_reclaim_on, zero_paged_on;
#endif

+int hzrate = HZ; /* exported readonly */
+
extern int pgt_cache_water[];

static int parse_table(int *, int, void *, size_t *, void *, size_t,
@@ -184,6 +186,8 @@
{KERN_SG_BIG_BUFF, "sg-big-buff", &sg_big_buff, sizeof (int),
0444, NULL, &proc_dointvec},
#endif
+ {KERN_HZ, "clock-rate", &hzrate, sizeof(int), 0444, NULL,
+ &proc_dointvec},
{0}
};

-Andi

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/