On Tue, Aug 04, 2009 at 09:42:41AM +0800, Pei Lin wrote: > 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. Look at the code I provided, it gives you the value you need to care about. > > 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? That is the only way. But again, it should not be an issue at all, except for some very special server loads which wants a low HZ value. Do you have a special workload that needs a specific HZ value to achieve its results? 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