Re: dynamic-hz

Andrea Arcangeli
2004-12-13T11:42:07Z

On Mon, Dec 13, 2004 at 12:22:29PM +0100, Pavel Machek wrote:
> I tried defining HZ to 10 once, and there are some #if arrays in the
> kernel that prevented me from doing that.

I guess you're right and the minimum is HZ=12. I'm pretty sure I could
go down to 25, perhaps the absolute minium was 12 and not 10.

There's also some side effect like this by setting strange HZ:

--- x-ref/net/sched/estimator.c 2003-03-15 03:25:19.000000000 +0100
+++ x/net/sched/estimator.c 2004-05-31 15:51:42.778909936 +0200
@@ -71,10 +71,6 @@
at user level painlessly.
*/

-#if (HZ%4) != 0
-#error Bad HZ value.
-#endif
-
#define EST_MAX_INTERVAL 5

struct qdisc_estimator
@@ -136,6 +132,9 @@ int qdisc_new_estimator(struct tc_stats
struct qdisc_estimator *est;
struct tc_estimator *parm = RTA_DATA(opt);

+ if (unlikely(HZ % 4))
+ return -EINVAL;
+
if (RTA_PAYLOAD(opt) < sizeof(*parm))
return -EINVAL;

If you boot with an HZ not divisible by 4 you get -EINVAL at runtime
(instead of a compile failure since we can't check it at compile time
anymore ;).

Anyway the major point of the patch is to get HZ switchable from 100 to
1000, those two values are really the only supported ones. The rest is a
bonus, and I'm sure at least 50 and 2000 will work flawlessy too.