HZ entry in /proc/sys/kernel
RFC 1/1 HZ entry in /proc/sys/kernel
I have seen few scripts allready that are assuming HZ==100. Afaik this value is different in 2.5/2.4 for the same arch. So is it worth to add on both simple /proc/sys/kernel/HZ ?
Simple patch for 2.4.21-rc3 , if it is allright i will do same thing for 2.5
----------------------------------------------------------
include/linux/sysctl.h 2003-05-26 12:44:16.000000000 +0100 renamed from include/linux/sysctl.h 2003-05-24 12:10:35.000000000 +0100 +0 -0
@@ -125,6 +125,7 @@ KERN_TAINTED=53, /* int: various kernel tainted flags */ KERN_CADPID=54, /* int: PID of the process to notify on
CAD */
KERN_CORE_PATTERN=56, /* string: pattern for core-files */
+ KERN_HZ=57, /* int: HZ value */
};
kernel/sysctl.c 2003-05-26 12:45:31.000000000 +0100 renamed from kernel/sysctl.c 2003-05-26 12:33:37.000000000 +0100 +3 -0
@@ -32,6 +32,7 @@ #include <linux/highuid.h> #include <asm/uaccess.h> +#include <asm/param.h> #ifdef CONFIG_ROOT_NFS #include <linux/nfs_fs.h>
@@ -123,6 +124,8 @@ #ifdef CONFIG_PROC_FS +static unsigned int hz=HZ; + static ssize_t proc_readsys(struct file *, char *, size_t, loff_t *); static ssize_t proc_writesys(struct file *, const char *, size_t,
loff_t *);
static int proc_sys_permission(struct inode *, int);
@@ -244,6 +247,8 @@
0600, NULL, &proc_dointvec},
{KERN_MAX_THREADS, "threads-max", &max_threads, sizeof(int),
0644, NULL, &proc_dointvec},+ {KERN_HZ, "HZ", &hz, sizeof(unsigned int),
+ 0444, NULL, &proc_dointvec},
{KERN_RANDOM, "random", NULL, 0, 0555, random_table}, {KERN_OVERFLOWUID, "overflowuid", &overflowuid, sizeof(int),
0644, NULL,
&proc_dointvec_minmax, &sysctl_intvec, NULL,
Signature · 2 lines
Grzegorz Jaskiewicz <[email protected]> K4 labs
Quoted 2 lines · Grzegorz Jaskiewicz
I have seen few scripts allready that are assuming HZ==100. Afaik this value is different in 2.5/2.4 for the same arch.
No it's not actually.
The userspace interface is constant/stable and in units of HZ=100 even though the kernel HZ might be different.
Quoted 8 lines · Arjan van de Ven
Quoted 2 lines · Grzegorz Jaskiewicz
I have seen few scripts allready that are assuming HZ==100. Afaik this value is different in 2.5/2.4 for the same arch.
No it's not actually.
The userspace interface is constant/stable and in units of HZ=100 even though the kernel HZ might be different.
What's this HZ value related to?
cheers,
Daniele
Quoted 11 lines · Daniele
Quoted 8 lines · Arjan van de Ven
Quoted 2 lines · Grzegorz Jaskiewicz
I have seen few scripts allready that are assuming HZ==100. Afaik this value is different in 2.5/2.4 for the same arch.
No it's not actually.
The userspace interface is constant/stable and in units of HZ=100 even though the kernel HZ might be different.What's this HZ value related to?
the userspace interface is not in units of kernel HZ, but in "theoretical time units that happen to match a defined default" which happens to match 10ms on x86.