linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: PATCH: /proc/sys/kernel/hz
@ 2001-07-16 19:24 Rolf Fokkens
  0 siblings, 0 replies; 7+ messages in thread
From: Rolf Fokkens @ 2001-07-16 19:24 UTC (permalink / raw)
  To: 'Andreas Jaeger'; +Cc: 'linux-kernel@vger.kernel.org'

Right.

The macro CLOCKS_PER_SEC is used for AT_CLKTCK, and for some architectures
there actually _is_ a relationship between CLOCKS_PER_SEC and HZ, and for
some there is _not_ (linux/include/asm-*/param.h).

For i386 the relation apparently _is_ there. For IA64 there's the assumption
however that that the relation is _not_ there, the kernel assumes that it's
100 HZ for ia32 _always_. Weird.

Still leaves me wondering about procps.

Thanks,

Rolf

-----Original Message-----
From: Andreas Jaeger [mailto:aj@suse.de]
Sent: Monday, July 16, 2001 8:34 PM
To: Rolf Fokkens
Cc: 'drepper@cygnus.com'; 'alan@lxorguk.ukuu.org.uk';
'linux-kernel@vger.kernel.org'
Subject: Re: PATCH: /proc/sys/kernel/hz


Rolf Fokkens <FokkensR@vertis.nl> writes:

> Ulrich Drepper <drepper@redhat.com> writes:
> 
>>> Some software (like procps) needs the HZ constant in the kernel. It's
>>> sometimes determined by counting jiffies during a second. The attached
> patch
>>> just "publishes" the HZ constant in /proc/sys/kernel/hz.
>>
>>And what is wrong with
>>  getconf CLK_TCK
>>or programmatically
>>  hz = sysconf (_SC_CLK_TCK);
> 
> In short: it doesn't work: it reads 100 while I changed it to 1024 in my
> kernel.

Then your kernel is broken, check AT_CLKTCK,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: /proc/sys/kernel/hz
  2001-07-16 18:00 Rolf Fokkens
@ 2001-07-16 18:34 ` Andreas Jaeger
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Jaeger @ 2001-07-16 18:34 UTC (permalink / raw)
  To: Rolf Fokkens
  Cc: 'drepper@cygnus.com', 'alan@lxorguk.ukuu.org.uk',
	'linux-kernel@vger.kernel.org'

Rolf Fokkens <FokkensR@vertis.nl> writes:

> Ulrich Drepper <drepper@redhat.com> writes:
> 
>>> Some software (like procps) needs the HZ constant in the kernel. It's
>>> sometimes determined by counting jiffies during a second. The attached
> patch
>>> just "publishes" the HZ constant in /proc/sys/kernel/hz.
>>
>>And what is wrong with
>>  getconf CLK_TCK
>>or programmatically
>>  hz = sysconf (_SC_CLK_TCK);
> 
> In short: it doesn't work: it reads 100 while I changed it to 1024 in my
> kernel.

Then your kernel is broken, check AT_CLKTCK,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: PATCH: /proc/sys/kernel/hz
@ 2001-07-16 18:00 Rolf Fokkens
  2001-07-16 18:34 ` Andreas Jaeger
  0 siblings, 1 reply; 7+ messages in thread
From: Rolf Fokkens @ 2001-07-16 18:00 UTC (permalink / raw)
  To: 'drepper@cygnus.com'
  Cc: 'alan@lxorguk.ukuu.org.uk',
	'linux-kernel@vger.kernel.org'

Ulrich Drepper <drepper@redhat.com> writes:

>> Some software (like procps) needs the HZ constant in the kernel. It's
>> sometimes determined by counting jiffies during a second. The attached
patch
>> just "publishes" the HZ constant in /proc/sys/kernel/hz.
>
>And what is wrong with
>  getconf CLK_TCK
>or programmatically
>  hz = sysconf (_SC_CLK_TCK);

In short: it doesn't work: it reads 100 while I changed it to 1024 in my
kernel.

> Update your libc and this info will come from the kernel.

Neither RedHat 6.2 (glibc-2.1.3) nor SuSE 7.2 (glibc-2.2.2) works, so what
glibc version are you suggesting?

And suppose I have the right glibc, then the kernel may become a little
confusing:

bash# cd linux-2.4.6
bash# find . -name "*.c" -exec grep -q CLK_TCK {} \; -print
#define   _SC_CLK_TCK             3
./arch/sparc/kernel/sys_sunos.c
#define   _SC_CLK_TCK             3
./arch/sparc64/kernel/sys_sunos32.c
#define	SOLARIS_CONFIG_CLK_TCK			7
./arch/sparc64/solaris/misc.c
bash# find . -name "*.h" -exec grep CLK_TCK {} \; -print
#define   _SC_CLK_TCK             3
./include/asm-sparc64/unistd.h

Seems OK for sparc and maybe for solaris, for others it's a mess.

Rolf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: /proc/sys/kernel/hz
  2001-07-16 17:13   ` Kurt Garloff
@ 2001-07-16 17:45     ` Ulrich Drepper
  0 siblings, 0 replies; 7+ messages in thread
From: Ulrich Drepper @ 2001-07-16 17:45 UTC (permalink / raw)
  To: VGER kernel list

Kurt Garloff <garloff@suse.de> writes:

> Suppose HZ is variable. How does glibc find out about HZ of the _running_
> kernel? Just curious ... as I don't see a public place where the kernel
> publishes such info.

You people don't even know your kernel:

  $ LD_SHOW_AUXV=1 getconf CLK_TCK

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: /proc/sys/kernel/hz
  2001-07-16 16:50 ` Ulrich Drepper
@ 2001-07-16 17:13   ` Kurt Garloff
  2001-07-16 17:45     ` Ulrich Drepper
  0 siblings, 1 reply; 7+ messages in thread
From: Kurt Garloff @ 2001-07-16 17:13 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: Linux kernel list

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

On Mon, Jul 16, 2001 at 09:50:35AM -0700, Ulrich Drepper wrote:
> 
>   hz = sysconf (_SC_CLK_TCK);
> 
> Update your libc and this info will come from the kernel.

Suppose HZ is variable. How does glibc find out about HZ of the _running_
kernel? Just curious ... as I don't see a public place where the kernel
publishes such info.

Regards,
-- 
Kurt Garloff  <garloff@suse.de>                          Eindhoven, NL
GPG key: See mail header, key servers         Linux kernel development
SuSE GmbH, Nuernberg, FRG                               SCSI, Security

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: PATCH: /proc/sys/kernel/hz
  2001-07-16 16:11 Rolf Fokkens
@ 2001-07-16 16:50 ` Ulrich Drepper
  2001-07-16 17:13   ` Kurt Garloff
  0 siblings, 1 reply; 7+ messages in thread
From: Ulrich Drepper @ 2001-07-16 16:50 UTC (permalink / raw)
  To: Rolf Fokkens
  Cc: 'alan@lxorguk.ukuu.org.uk',
	'linux-kernel@vger.kernel.org'

Rolf Fokkens <FokkensR@vertis.nl> writes:

> Some software (like procps) needs the HZ constant in the kernel. It's
> sometimes determined by counting jiffies during a second. The attached patch
> just "publishes" the HZ constant in /proc/sys/kernel/hz.

And what is wrong with

  getconf CLK_TCK

or programmatically

  hz = sysconf (_SC_CLK_TCK);


Update your libc and this info will come from the kernel.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* PATCH: /proc/sys/kernel/hz
@ 2001-07-16 16:11 Rolf Fokkens
  2001-07-16 16:50 ` Ulrich Drepper
  0 siblings, 1 reply; 7+ messages in thread
From: Rolf Fokkens @ 2001-07-16 16:11 UTC (permalink / raw)
  To: 'alan@lxorguk.ukuu.org.uk'; +Cc: 'linux-kernel@vger.kernel.org'

[-- Attachment #1: Type: text/plain, Size: 216 bytes --]

Hi!

Some software (like procps) needs the HZ constant in the kernel. It's
sometimes determined by counting jiffies during a second. The attached patch
just "publishes" the HZ constant in /proc/sys/kernel/hz.

Rolf


[-- Attachment #2: linux-2.4.6-sysctl.hz.patch --]
[-- Type: application/octet-stream, Size: 1628 bytes --]

The HZ kernel constant is not the same on all platforms. The procps library
seems to need it's value however, it estimates it by measuring during a second.
This patch publishes the HZ value in /proc/sys/kernel/hz for the convenience
of tools that need it's value.

--- linux/include/linux/sysctl.h.sysctlhz	Sun May 27 14:12:56 2001
+++ linux/include/linux/sysctl.h	Mon Jul 16 11:12:45 2001
@@ -118,7 +118,9 @@
 	KERN_SHMPATH=48,	/* string: path to shm fs */
 	KERN_HOTPLUG=49,	/* string: path to hotplug policy agent */
 	KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */
-	KERN_S390_USER_DEBUG_LOGGING=51  /* int: dumps of user faults */
+	KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */
+
+	KERN_HZ=60		/* compiled in HZ value */
 };
 
 
--- linux/kernel/sysctl.c.sysctlhz	Thu Apr 12 21:20:31 2001
+++ linux/kernel/sysctl.c	Mon Jul 16 14:54:27 2001
@@ -16,6 +16,7 @@
  *  Wendling.
  * The list_for_each() macro wasn't appropriate for the sysctl loop.
  *  Removed it and replaced it with older style, 03/23/00, Bill Wendling
+ * Added hz (HZ), 07/16/01, Rolf Fokkens
  */
 
 #include <linux/config.h>
@@ -153,6 +154,8 @@
 	{0}
 };
 
+static int hz_value = HZ;
+
 static ctl_table kern_table[] = {
 	{KERN_OSTYPE, "ostype", system_utsname.sysname, 64,
 	 0444, NULL, &proc_doutsstring, &sysctl_string},
@@ -249,6 +252,8 @@
 	{KERN_S390_USER_DEBUG_LOGGING,"userprocess_debug",
 	 &sysctl_userprocess_debug,sizeof(int),0644,NULL,&proc_dointvec},
 #endif
+	{KERN_HZ, "hz", &hz_value,sizeof(int),
+	 0444, NULL, &proc_dointvec},
 	{0}
 };
 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2001-07-16 19:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-16 19:24 PATCH: /proc/sys/kernel/hz Rolf Fokkens
  -- strict thread matches above, loose matches on Subject: below --
2001-07-16 18:00 Rolf Fokkens
2001-07-16 18:34 ` Andreas Jaeger
2001-07-16 16:11 Rolf Fokkens
2001-07-16 16:50 ` Ulrich Drepper
2001-07-16 17:13   ` Kurt Garloff
2001-07-16 17:45     ` Ulrich Drepper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).