ia64: change usermode HZ to 250
PATCH 1/1 ia64: change usermode HZ to 250
include/asm-ia64/param.h defines HZ to be 1024 for usermode use, i.e., when the file gets installed as /usr/include/asm/param.h.
As the comment says:
Technically, this is wrong, but some old apps still refer to it. The proper way to get the HZ value is via sysconf(_SC_CLK_TCK).
At the very least, this technically wrong #define ought to reflect the current default value (250) used by all arch/ia64 platforms. No one uses 1024 anymore. This makes those "old apps" (e.g., usr/bin/iostat) behave properly for with a default kernel. (And at some point, the define ought to be removed altogether, which would expose all the applications that erroneously expect HZ to be a compile-time constant.)
Index: linux/include/asm-ia64/param.h
=================================--- linux.orig/include/asm-ia64/param.h 2006-06-17 18:49:35.000000000 -0700
+++ linux/include/asm-ia64/param.h 2006-06-27 14:46:53.119407077 -0700
@@ -36,7 +36,7 @@
* Technically, this is wrong, but some old apps still refer to it. The proper way to
* get the HZ value is via sysconf(_SC_CLK_TCK).
*/
-# define HZ 1024
+# define HZ 250
#endif
#endif /* _ASM_IA64_PARAM_H */
Quoted 18 lines · On Tue, 2006-06-27 at 15:01 -0700, [email protected] wrote:
include/asm-ia64/param.hdefines HZ to be 1024 for usermode use, i.e., when the file gets installed as/usr/include/asm/param.h.
As the comment says:
Technically, this is wrong, but some old apps still refer to it. The proper way to get the HZ value is viasysconf(_SC_CLK_TCK).
At the very least, this technically wrong #define ought to reflect the current default value (250) used by allarch/ia64platforms. No one uses 1024 anymore. This makes those "old apps" (e.g.,usr/bin/iostat) behave properly for with a default kernel. (And at some point, the define ought to be removed altogether, which would expose all the applications that erroneously expect HZ to be a compile-time constant.)Signed-off-by John Hawkes <[email protected]>Index:
linux/include/asm-ia64/param.h
=================================> ---linux.orig/include/asm-ia64/param.h2006-06-17 18:49:35.000000000 -0700
+++linux/include/asm-ia64/param.h2006-06-27 14:46:53.119407077 -0700
Review line 40
Quoted 6 lines
(quoted diff) +1
-1@@ -36,7 +36,7 @@ * Technically, this is wrong, but some old apps still refer to it. The proper way to * get the HZ value is via sysconf(_SC_CLK_TCK). */ -# define HZ 1024 +# define HZ 250 #endif
ok why not define the userspace HZ to
#define HZ sysconf(_SC_CLK_TCK)
?
From: "Arjan van de Ven" <[email protected]>
...
Quoted 3 lines
ok why not define the userspace HZ to
#define HZ
sysconf(_SC_CLK_TCK)
That did occur to me. It obviously does get the correct value. The downside is that one of those crufty apps that thinks it is using "HZ" as a constant will instead be invoking a more costly syscall. Should we care about the resulting performance impact?
I vote for Arjan's solution.
John Hawkes
Ar Mer, 2006-06-28 am 08:43 -0700, ysgrifennodd John Hawkes:
Quoted 6 lines
Quoted 1 line
#define HZ
sysconf(_SC_CLK_TCK)That did occur to me. It obviously does get the correct value. The downside is that one of those crufty apps that thinks it is using "HZ" as a constant will instead be invoking a more costly syscall. Should we care about the resulting performance impact?
Given that HZ can be cached by glibc the performance impact is minimal for most cases. The bigger problem will be code that does things with HZ that only work on compile time evaluation. At least for those you'll break at compile time.
Either way its kind of irrelevant, the ABI set HZ. Its done, there are plenty of ways to change the kernel HZ without confusing userspace.
Alan
Quoted 15 lines · Alan Cox
Ar Mer, 2006-06-28 am 08:43 -0700, ysgrifennodd John Hawkes:
Quoted 7 lines
Quoted 2 lines
#define HZ
sysconf(_SC_CLK_TCK)That did occur to me. It obviously does get the correct value. The downside is that one of those crufty apps that thinks it is using "HZ" as a constant will instead be invoking a more costly syscall. Should we care about the resulting performance impact?
Given that HZ can be cached by glibc the performance impact is minimal for most cases. The bigger problem will be code that does things with HZ that only work on compile time evaluation. At least for those you'll break at compile time.
Quoted 6 lines
Either way its kind of irrelevant, the ABI set HZ. Its done, there are plenty of ways to change the kernel HZ without confusing userspace.
Alan
Alan, I agree with Arjan's solution as well. From a very novice point of view, it makes sense to #define HZ as a syscall (which it technically should be anyway, right?). Any performance hit isn't our problem... people should have been using the syscall to begin with... we're just forcing it on them this way! :-) That's my $0.02
John Daiker
Ar Mer, 2006-06-28 am 09:11 -0700, ysgrifennodd John Daiker:
Quoted 2 lines
people should have been using the syscall to begin with... we're just forcing it on them this way! :-) That's my $0.02
In the cached HZ case there will be no performance hit of measure anyway. The bigger problem is existing user space. That is why we've always kept the user visible HZ based values the same when changing the kernel HZ. You can't automatically regenerate all the old binaries you might otherwise break.
Performance is only a minor issue, and I doubt anyone who cared about performance would be using ia-64 anyway
[Grabs coat and exits..]