Re: finding out the value of HZ from userspace

From: Andi Kleen
Date: Tue Mar 16 2004 - 04:12:49 EST


> So it does and POSIX.1 (_SC_CLK_TCK) compliant as well. Unfortunately,
> the presence of this functionality makes it VERY difficult to understand
> why ticks are being converted from HZ==1000 values to HZ=100 values when
> they are being exported to user space especially as this conversion
> throws away precision. Can anyone enlighten me?

There are two different cases here:

Timer tick as visible to user space in the minimum delay of select()
and other kernel functions with timeout. That is what AT_CLKTCK aims at.

And exports of values with jiffie units in sysctls in /proc. This was in fact i
always a bug because they should have used ms or s as unit
(there are readily usable utility functions to do this for sysctl). Otherwise
writing documentation becomes quite difficult. But there are already i
configurations that set or read these values and was not a good idea to
subtly and silently break them. Especially since they predate any exporting
of HZ to user space. So the the conversion factor was added.

This is not only obscure sysctls, ps and top are also consumers of such
jiffies values in /proc

-Andi

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