Re: how to list the current HZ value?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2009/8/2 Greg KH <greg@xxxxxxxxx>:
> On Sat, Aug 01, 2009 at 03:36:21PM -0400, Robert P. J. Day wrote:
>> On Sat, 1 Aug 2009, Greg KH wrote:
>>
>> > On Fri, Jul 31, 2009 at 11:23:15AM +0700, Mulyadi Santosa wrote:
>> > > On Fri, Jul 31, 2009 at 6:52 AM, Karel Zak<kzak@xxxxxxxxxx> wrote:
>> > > It seems that user space sees HZ as 100, while in fact my current
>> > > running kernel is compiled with HZ=300. What do you think about it? Or
>> > > is there something wrong with my conclusion?
>> >
>> > The following C program should properly show you the kernel HZ.
>> >
>> > thanks,
>> >
>> > greg k-h
>> >
>> > --------------
>> >
>> > #include <unistd.h>
>> > #include <time.h>
>> > #include <stdio.h>
>> >
>> > int main()
>> > {
>> >     struct timespec res;
>> >     double resolution;
>> >
>> >     printf("UserHZ   %ld\n", sysconf(_SC_CLK_TCK));
>> >
>> >     clock_getres(CLOCK_REALTIME, &res);
>> >     resolution = res.tv_sec + (((double)res.tv_nsec)/1.0e9);
>> >
>> >     printf("SystemHZ %ld\n", (unsigned long)(1/resolution + 0.5));
>> >     return 0;
>> > }
>>
>>   i already knew about sysconf.  so i'm going to assume there's no
>> simpler way to get the current HZ (either command line or /proc
>> based).
>
> But the point is, from userspace's point of view, the kernel HZ value
> means NOTHING.  See the above program that shows what the resolution
> that userspace can use is.  That is what userspace cares about, and what
> the kernel provides.  Internal HZ values of what the kernel might use
> for scheduling means _nothing_.
>
but some applications or drivers especially for stream media i think
they need this parameter to get a balance for performance.
refer to the link: http://lwn.net/Articles/145973/
i think people need it to configure their kernel.

> So if you do provide it to userspace in a proc file, what then? What is
> userspace going to do with such a value?  It should never depend on it,
> because it doesn't matter to it.
>
how do we change the kernel HZ parameter except reconfiguration kernel
and rebuild kernel?
Nowadays with the big kernel, rebuild it again and again i think it is
not a very happy thing.
Do the kernel have a mechanism to change all the configuration
dynamically without rebuilding kernel?


BRs

Lin

> thanks,
>
> greg k-h
>
> --
> To unsubscribe from this list: send an email with
> "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
> Please read the FAQ at http://kernelnewbies.org/FAQ
>
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux